{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e64d4451-6195-4951-a435-51891d179209",
   "metadata": {},
   "source": [
    "# sample get"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "4d455b26-723f-44fe-af7a-c9e512e8288b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>9412_0</th>\n",
       "      <th>9562_0</th>\n",
       "      <th>9773_0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038136</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038137</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038138</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038139</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038140</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8194</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038070</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8195</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038071</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8196</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038072</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8197</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038073</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8198</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038074</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8199 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       chr  position  11298_0  3403_0  5416_0  8239_0  9412_0  9562_0  9773_0\n",
       "0     chr6  32038136      2.0     2.0     0.0     0.0     1.0     5.0     4.0\n",
       "1     chr6  32038137      2.0     2.0     0.0     0.0     1.0     5.0     4.0\n",
       "2     chr6  32038138      2.0     2.0     0.0     0.0     1.0     5.0     4.0\n",
       "3     chr6  32038139      2.0     2.0     0.0     0.0     1.0     5.0     4.0\n",
       "4     chr6  32038140      2.0     2.0     0.0     0.0     1.0     5.0     4.0\n",
       "...    ...       ...      ...     ...     ...     ...     ...     ...     ...\n",
       "8194  chr6  32038070      0.0     0.0     0.0     3.0     0.0     2.0     0.0\n",
       "8195  chr6  32038071      0.0     0.0     0.0     3.0     0.0     2.0     0.0\n",
       "8196  chr6  32038072      0.0     0.0     0.0     3.0     0.0     2.0     0.0\n",
       "8197  chr6  32038073      0.0     0.0     0.0     3.0     0.0     2.0     0.0\n",
       "8198  chr6  32038074      0.0     0.0     0.0     3.0     0.0     2.0     0.0\n",
       "\n",
       "[8199 rows x 9 columns]"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os \n",
    "import pandas as pd\n",
    "\n",
    "\n",
    "def get_data(path, MQ=0):\n",
    "\n",
    "    fileList = os.listdir(Path_2rd_3rd_dir)\n",
    "    fileList = [x for x in fileList if x.startswith('NGS')]\n",
    "    notIn = ['NGS_13747_BW_C', 'NGS_14845_BW_C', 'NGS_14847_BW_C', 'NGS_16106_BW_C']  # , 'NGS_11298_BW_C'   standard Sample: 40,41\n",
    "    fileList = [x for x in fileList if x not in notIn]\n",
    "    fileList.sort()\n",
    "    print(fileList)\n",
    "    dfs = []\n",
    "    for fileDir in fileList[:]:\n",
    "        fullDepthPath = os.path.join(Path_2rd_3rd_dir, fileDir, fileDir + \".MQ\" + str(MQ) + \".CYP21A2.depth.tsv\")   # NGS_3403_BW_C.MQ0.CYP21A2.depth.tsv\n",
    "        code = fileDir.split('_')[1]\n",
    "        colName = code + \"_\" + str(MQ)\n",
    "        df = pd.read_csv(fullDepthPath, header=None, names=[\"chr\", 'position', colName], sep='\\t')\n",
    "        df.set_index(['chr', 'position'], inplace=True)\n",
    "        dfs.append(df)\n",
    "\n",
    "    merged_df_23 = pd.concat(dfs, axis=1).reset_index()\n",
    "    merged_df_23.fillna(0, inplace=True)\n",
    "    return merged_df_23\n",
    "    \n",
    "Path_2rd_3rd_dir = \"/lustre/home/acct-medfzx/medfzx-lkw/project/2rd_NGS_annovar_LD/result/Patient_WES_have_hifi/bam\"\n",
    "merged_df_23 = get_data(Path_2rd_3rd_dir, MQ=0)\n",
    "merged_df_23\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fa610c9a-678d-44dc-9b90-26a6c99b4095",
   "metadata": {},
   "source": [
    "## standar avg std "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "901f600b-68d8-4185-9955-ff0bf2ec54f3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>9412_0</th>\n",
       "      <th>9562_0</th>\n",
       "      <th>9773_0</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038136</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038137</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038138</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038139</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038140</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8194</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038070</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8195</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038071</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8196</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038072</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8197</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038073</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8198</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038074</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8199 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       chr  position  11298_0  3403_0  5416_0  8239_0  9412_0  9562_0  9773_0  \\\n",
       "0     chr6  32038136      2.0     2.0     0.0     0.0     1.0     5.0     4.0   \n",
       "1     chr6  32038137      2.0     2.0     0.0     0.0     1.0     5.0     4.0   \n",
       "2     chr6  32038138      2.0     2.0     0.0     0.0     1.0     5.0     4.0   \n",
       "3     chr6  32038139      2.0     2.0     0.0     0.0     1.0     5.0     4.0   \n",
       "4     chr6  32038140      2.0     2.0     0.0     0.0     1.0     5.0     4.0   \n",
       "...    ...       ...      ...     ...     ...     ...     ...     ...     ...   \n",
       "8194  chr6  32038070      0.0     0.0     0.0     3.0     0.0     2.0     0.0   \n",
       "8195  chr6  32038071      0.0     0.0     0.0     3.0     0.0     2.0     0.0   \n",
       "8196  chr6  32038072      0.0     0.0     0.0     3.0     0.0     2.0     0.0   \n",
       "8197  chr6  32038073      0.0     0.0     0.0     3.0     0.0     2.0     0.0   \n",
       "8198  chr6  32038074      0.0     0.0     0.0     3.0     0.0     2.0     0.0   \n",
       "\n",
       "      avg       std  \n",
       "0     3.0  2.828427  \n",
       "1     3.0  2.828427  \n",
       "2     3.0  2.828427  \n",
       "3     3.0  2.828427  \n",
       "4     3.0  2.828427  \n",
       "...   ...       ...  \n",
       "8194  1.0  1.414214  \n",
       "8195  1.0  1.414214  \n",
       "8196  1.0  1.414214  \n",
       "8197  1.0  1.414214  \n",
       "8198  1.0  1.414214  \n",
       "\n",
       "[8199 rows x 11 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def get_standard_avg_std(df):   # 计算各行的均值和标准差（从第3列开始）\n",
    "    df['avg'] = df.iloc[:, 6:8].mean(axis=1)\n",
    "    df['std'] = df.iloc[:, 6:8].std(axis=1)\n",
    "    return df\n",
    "\n",
    "merged_df_23 = get_standard_avg_std(merged_df_23)\n",
    "merged_df_23"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f15f522f-1311-4966-93b6-a711dd97b7b1",
   "metadata": {},
   "source": [
    "## judge_range "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "0a639b26-b163-461b-bdca-22dda2aefd79",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9412_0</th>\n",
       "      <th>stdR_9412</th>\n",
       "      <th>9562_0</th>\n",
       "      <th>stdR_9562</th>\n",
       "      <th>9773_0</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038136</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.353553</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038137</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.353553</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038138</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.353553</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038139</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.353553</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038140</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.353553</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.828427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8194</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038070</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.414214</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8195</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038071</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.414214</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8196</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038072</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.414214</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8197</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038073</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.414214</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8198</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038074</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.414214</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.414214</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8199 rows × 18 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       chr  position  11298_0  stdR_11298  3403_0  stdR_3403  5416_0  \\\n",
       "0     chr6  32038136      2.0   -0.353553     2.0  -0.353553     0.0   \n",
       "1     chr6  32038137      2.0   -0.353553     2.0  -0.353553     0.0   \n",
       "2     chr6  32038138      2.0   -0.353553     2.0  -0.353553     0.0   \n",
       "3     chr6  32038139      2.0   -0.353553     2.0  -0.353553     0.0   \n",
       "4     chr6  32038140      2.0   -0.353553     2.0  -0.353553     0.0   \n",
       "...    ...       ...      ...         ...     ...        ...     ...   \n",
       "8194  chr6  32038070      0.0   -0.707107     0.0  -0.707107     0.0   \n",
       "8195  chr6  32038071      0.0   -0.707107     0.0  -0.707107     0.0   \n",
       "8196  chr6  32038072      0.0   -0.707107     0.0  -0.707107     0.0   \n",
       "8197  chr6  32038073      0.0   -0.707107     0.0  -0.707107     0.0   \n",
       "8198  chr6  32038074      0.0   -0.707107     0.0  -0.707107     0.0   \n",
       "\n",
       "      stdR_5416  8239_0  stdR_8239  9412_0  stdR_9412  9562_0  stdR_9562  \\\n",
       "0     -1.060660     0.0  -1.060660     1.0  -0.707107     5.0   0.707107   \n",
       "1     -1.060660     0.0  -1.060660     1.0  -0.707107     5.0   0.707107   \n",
       "2     -1.060660     0.0  -1.060660     1.0  -0.707107     5.0   0.707107   \n",
       "3     -1.060660     0.0  -1.060660     1.0  -0.707107     5.0   0.707107   \n",
       "4     -1.060660     0.0  -1.060660     1.0  -0.707107     5.0   0.707107   \n",
       "...         ...     ...        ...     ...        ...     ...        ...   \n",
       "8194  -0.707107     3.0   1.414214     0.0  -0.707107     2.0   0.707107   \n",
       "8195  -0.707107     3.0   1.414214     0.0  -0.707107     2.0   0.707107   \n",
       "8196  -0.707107     3.0   1.414214     0.0  -0.707107     2.0   0.707107   \n",
       "8197  -0.707107     3.0   1.414214     0.0  -0.707107     2.0   0.707107   \n",
       "8198  -0.707107     3.0   1.414214     0.0  -0.707107     2.0   0.707107   \n",
       "\n",
       "      9773_0  stdR_9773  avg       std  \n",
       "0        4.0   0.353553  3.0  2.828427  \n",
       "1        4.0   0.353553  3.0  2.828427  \n",
       "2        4.0   0.353553  3.0  2.828427  \n",
       "3        4.0   0.353553  3.0  2.828427  \n",
       "4        4.0   0.353553  3.0  2.828427  \n",
       "...      ...        ...  ...       ...  \n",
       "8194     0.0  -0.707107  1.0  1.414214  \n",
       "8195     0.0  -0.707107  1.0  1.414214  \n",
       "8196     0.0  -0.707107  1.0  1.414214  \n",
       "8197     0.0  -0.707107  1.0  1.414214  \n",
       "8198     0.0  -0.707107  1.0  1.414214  \n",
       "\n",
       "[8199 rows x 18 columns]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def judge_range(df):\n",
    "    for num, colName in enumerate(df.iloc[:, 2:-2].columns):\n",
    "        name = colName.split('_')[0]\n",
    "        df.insert(3 + num*2, 'stdR_' + name, (df[colName] - df['avg']) / df['std'])\n",
    "    return df \n",
    "\n",
    "merged_df_23 = judge_range(merged_df_23)\n",
    "merged_df_23\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0b5790e1-cadc-4656-ba17-589a2424b648",
   "metadata": {},
   "source": [
    "## standard fixed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "3f99424c-c921-4eee-8cec-986791de84c9",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(11, 18)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9773_0</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>543</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038679</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-4.164073</td>\n",
       "      <td>131.0</td>\n",
       "      <td>9.506658</td>\n",
       "      <td>32.0</td>\n",
       "      <td>-6.049691</td>\n",
       "      <td>100.0</td>\n",
       "      <td>4.635478</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-2.749860</td>\n",
       "      <td>70.5</td>\n",
       "      <td>6.363961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1141</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039277</td>\n",
       "      <td>40.0</td>\n",
       "      <td>0.176777</td>\n",
       "      <td>85.0</td>\n",
       "      <td>8.131728</td>\n",
       "      <td>36.0</td>\n",
       "      <td>-0.530330</td>\n",
       "      <td>108.0</td>\n",
       "      <td>12.197592</td>\n",
       "      <td>37.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>39.0</td>\n",
       "      <td>5.656854</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1538</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039674</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-0.252538</td>\n",
       "      <td>67.0</td>\n",
       "      <td>1.666752</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-0.555584</td>\n",
       "      <td>54.0</td>\n",
       "      <td>1.010153</td>\n",
       "      <td>43.0</td>\n",
       "      <td>0.454569</td>\n",
       "      <td>34.0</td>\n",
       "      <td>19.798990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2526</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040662</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-2.828427</td>\n",
       "      <td>229.0</td>\n",
       "      <td>30.582368</td>\n",
       "      <td>22.0</td>\n",
       "      <td>-6.010408</td>\n",
       "      <td>135.0</td>\n",
       "      <td>13.965359</td>\n",
       "      <td>52.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>56.0</td>\n",
       "      <td>5.656854</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2830</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040966</td>\n",
       "      <td>178.0</td>\n",
       "      <td>1.331565</td>\n",
       "      <td>246.0</td>\n",
       "      <td>2.580481</td>\n",
       "      <td>98.0</td>\n",
       "      <td>-0.137748</td>\n",
       "      <td>217.0</td>\n",
       "      <td>2.047855</td>\n",
       "      <td>113.0</td>\n",
       "      <td>0.137748</td>\n",
       "      <td>105.5</td>\n",
       "      <td>54.447222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3803</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041939</td>\n",
       "      <td>199.0</td>\n",
       "      <td>0.848528</td>\n",
       "      <td>287.0</td>\n",
       "      <td>3.959798</td>\n",
       "      <td>110.0</td>\n",
       "      <td>-2.298097</td>\n",
       "      <td>371.0</td>\n",
       "      <td>6.929646</td>\n",
       "      <td>180.0</td>\n",
       "      <td>0.176777</td>\n",
       "      <td>175.0</td>\n",
       "      <td>28.284271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4611</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042747</td>\n",
       "      <td>237.0</td>\n",
       "      <td>0.976481</td>\n",
       "      <td>491.0</td>\n",
       "      <td>18.081731</td>\n",
       "      <td>150.0</td>\n",
       "      <td>-4.882404</td>\n",
       "      <td>354.0</td>\n",
       "      <td>8.855671</td>\n",
       "      <td>198.0</td>\n",
       "      <td>-1.649916</td>\n",
       "      <td>222.5</td>\n",
       "      <td>14.849242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4883</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043019</td>\n",
       "      <td>189.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>342.0</td>\n",
       "      <td>7.614996</td>\n",
       "      <td>130.0</td>\n",
       "      <td>-3.916284</td>\n",
       "      <td>368.0</td>\n",
       "      <td>9.029210</td>\n",
       "      <td>179.0</td>\n",
       "      <td>-1.251035</td>\n",
       "      <td>202.0</td>\n",
       "      <td>18.384776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5052</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043188</td>\n",
       "      <td>226.0</td>\n",
       "      <td>-0.183324</td>\n",
       "      <td>413.0</td>\n",
       "      <td>4.714045</td>\n",
       "      <td>184.0</td>\n",
       "      <td>-1.283268</td>\n",
       "      <td>390.0</td>\n",
       "      <td>4.111695</td>\n",
       "      <td>182.0</td>\n",
       "      <td>-1.335646</td>\n",
       "      <td>233.0</td>\n",
       "      <td>38.183766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5349</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043485</td>\n",
       "      <td>174.0</td>\n",
       "      <td>0.515997</td>\n",
       "      <td>235.0</td>\n",
       "      <td>2.847538</td>\n",
       "      <td>109.0</td>\n",
       "      <td>-1.968432</td>\n",
       "      <td>252.0</td>\n",
       "      <td>3.497312</td>\n",
       "      <td>131.0</td>\n",
       "      <td>-1.127549</td>\n",
       "      <td>160.5</td>\n",
       "      <td>26.162951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6393</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32044529</td>\n",
       "      <td>213.0</td>\n",
       "      <td>-0.215206</td>\n",
       "      <td>454.0</td>\n",
       "      <td>4.724293</td>\n",
       "      <td>135.0</td>\n",
       "      <td>-1.813883</td>\n",
       "      <td>377.0</td>\n",
       "      <td>3.146113</td>\n",
       "      <td>226.0</td>\n",
       "      <td>0.051240</td>\n",
       "      <td>223.5</td>\n",
       "      <td>48.790368</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       chr  position  11298_0  stdR_11298  3403_0  stdR_3403  5416_0  \\\n",
       "543   chr6  32038679     44.0   -4.164073   131.0   9.506658    32.0   \n",
       "1141  chr6  32039277     40.0    0.176777    85.0   8.131728    36.0   \n",
       "1538  chr6  32039674     29.0   -0.252538    67.0   1.666752    23.0   \n",
       "2526  chr6  32040662     40.0   -2.828427   229.0  30.582368    22.0   \n",
       "2830  chr6  32040966    178.0    1.331565   246.0   2.580481    98.0   \n",
       "3803  chr6  32041939    199.0    0.848528   287.0   3.959798   110.0   \n",
       "4611  chr6  32042747    237.0    0.976481   491.0  18.081731   150.0   \n",
       "4883  chr6  32043019    189.0   -0.707107   342.0   7.614996   130.0   \n",
       "5052  chr6  32043188    226.0   -0.183324   413.0   4.714045   184.0   \n",
       "5349  chr6  32043485    174.0    0.515997   235.0   2.847538   109.0   \n",
       "6393  chr6  32044529    213.0   -0.215206   454.0   4.724293   135.0   \n",
       "\n",
       "      stdR_5416  8239_0  stdR_8239  9773_0  stdR_9773    avg        std  \n",
       "543   -6.049691   100.0   4.635478    53.0  -2.749860   70.5   6.363961  \n",
       "1141  -0.530330   108.0  12.197592    37.0  -0.353553   39.0   5.656854  \n",
       "1538  -0.555584    54.0   1.010153    43.0   0.454569   34.0  19.798990  \n",
       "2526  -6.010408   135.0  13.965359    52.0  -0.707107   56.0   5.656854  \n",
       "2830  -0.137748   217.0   2.047855   113.0   0.137748  105.5  54.447222  \n",
       "3803  -2.298097   371.0   6.929646   180.0   0.176777  175.0  28.284271  \n",
       "4611  -4.882404   354.0   8.855671   198.0  -1.649916  222.5  14.849242  \n",
       "4883  -3.916284   368.0   9.029210   179.0  -1.251035  202.0  18.384776  \n",
       "5052  -1.283268   390.0   4.111695   182.0  -1.335646  233.0  38.183766  \n",
       "5349  -1.968432   252.0   3.497312   131.0  -1.127549  160.5  26.162951  \n",
       "6393  -1.813883   377.0   3.146113   226.0   0.051240  223.5  48.790368  "
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "GGXL = [32038679, 32039277, 32039674, 32040662, 32040966, 32041939, 32042747, 32043019, 32043188, 32043485, 32044529]\n",
    "filtered_fixed = merged_df_23[merged_df_23['position'].isin(GGXL)]\n",
    "print(filtered_fixed.shape)\n",
    "del filtered_fixed['stdR_9412']\n",
    "del filtered_fixed['9412_0']\n",
    "del filtered_fixed['9562_0']\n",
    "del filtered_fixed['stdR_9562']\n",
    "filtered_fixed\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ae968613-42ee-45ac-8dea-50ff084a8754",
   "metadata": {},
   "source": [
    "### ratio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "1a5f3e18-deea-48e5-bd3c-3e575294b82e",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>Ratio_11298</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>Ratio_3403</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>Ratio_5416</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>Ratio_8239</th>\n",
       "      <th>9773_0</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>Ratio_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>543</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038679</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-4.164073</td>\n",
       "      <td>0.624113</td>\n",
       "      <td>131.0</td>\n",
       "      <td>9.506658</td>\n",
       "      <td>1.858156</td>\n",
       "      <td>32.0</td>\n",
       "      <td>-6.049691</td>\n",
       "      <td>0.453901</td>\n",
       "      <td>100.0</td>\n",
       "      <td>4.635478</td>\n",
       "      <td>1.418440</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-2.749860</td>\n",
       "      <td>0.751773</td>\n",
       "      <td>70.5</td>\n",
       "      <td>6.363961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1141</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039277</td>\n",
       "      <td>40.0</td>\n",
       "      <td>0.176777</td>\n",
       "      <td>1.025641</td>\n",
       "      <td>85.0</td>\n",
       "      <td>8.131728</td>\n",
       "      <td>2.179487</td>\n",
       "      <td>36.0</td>\n",
       "      <td>-0.530330</td>\n",
       "      <td>0.923077</td>\n",
       "      <td>108.0</td>\n",
       "      <td>12.197592</td>\n",
       "      <td>2.769231</td>\n",
       "      <td>37.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>0.948718</td>\n",
       "      <td>39.0</td>\n",
       "      <td>5.656854</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1538</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039674</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-0.252538</td>\n",
       "      <td>0.852941</td>\n",
       "      <td>67.0</td>\n",
       "      <td>1.666752</td>\n",
       "      <td>1.970588</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-0.555584</td>\n",
       "      <td>0.676471</td>\n",
       "      <td>54.0</td>\n",
       "      <td>1.010153</td>\n",
       "      <td>1.588235</td>\n",
       "      <td>43.0</td>\n",
       "      <td>0.454569</td>\n",
       "      <td>1.264706</td>\n",
       "      <td>34.0</td>\n",
       "      <td>19.798990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2526</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040662</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-2.828427</td>\n",
       "      <td>0.714286</td>\n",
       "      <td>229.0</td>\n",
       "      <td>30.582368</td>\n",
       "      <td>4.089286</td>\n",
       "      <td>22.0</td>\n",
       "      <td>-6.010408</td>\n",
       "      <td>0.392857</td>\n",
       "      <td>135.0</td>\n",
       "      <td>13.965359</td>\n",
       "      <td>2.410714</td>\n",
       "      <td>52.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.928571</td>\n",
       "      <td>56.0</td>\n",
       "      <td>5.656854</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2830</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040966</td>\n",
       "      <td>178.0</td>\n",
       "      <td>1.331565</td>\n",
       "      <td>1.687204</td>\n",
       "      <td>246.0</td>\n",
       "      <td>2.580481</td>\n",
       "      <td>2.331754</td>\n",
       "      <td>98.0</td>\n",
       "      <td>-0.137748</td>\n",
       "      <td>0.928910</td>\n",
       "      <td>217.0</td>\n",
       "      <td>2.047855</td>\n",
       "      <td>2.056872</td>\n",
       "      <td>113.0</td>\n",
       "      <td>0.137748</td>\n",
       "      <td>1.071090</td>\n",
       "      <td>105.5</td>\n",
       "      <td>54.447222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3803</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041939</td>\n",
       "      <td>199.0</td>\n",
       "      <td>0.848528</td>\n",
       "      <td>1.137143</td>\n",
       "      <td>287.0</td>\n",
       "      <td>3.959798</td>\n",
       "      <td>1.640000</td>\n",
       "      <td>110.0</td>\n",
       "      <td>-2.298097</td>\n",
       "      <td>0.628571</td>\n",
       "      <td>371.0</td>\n",
       "      <td>6.929646</td>\n",
       "      <td>2.120000</td>\n",
       "      <td>180.0</td>\n",
       "      <td>0.176777</td>\n",
       "      <td>1.028571</td>\n",
       "      <td>175.0</td>\n",
       "      <td>28.284271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4611</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042747</td>\n",
       "      <td>237.0</td>\n",
       "      <td>0.976481</td>\n",
       "      <td>1.065169</td>\n",
       "      <td>491.0</td>\n",
       "      <td>18.081731</td>\n",
       "      <td>2.206742</td>\n",
       "      <td>150.0</td>\n",
       "      <td>-4.882404</td>\n",
       "      <td>0.674157</td>\n",
       "      <td>354.0</td>\n",
       "      <td>8.855671</td>\n",
       "      <td>1.591011</td>\n",
       "      <td>198.0</td>\n",
       "      <td>-1.649916</td>\n",
       "      <td>0.889888</td>\n",
       "      <td>222.5</td>\n",
       "      <td>14.849242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4883</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043019</td>\n",
       "      <td>189.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>0.935644</td>\n",
       "      <td>342.0</td>\n",
       "      <td>7.614996</td>\n",
       "      <td>1.693069</td>\n",
       "      <td>130.0</td>\n",
       "      <td>-3.916284</td>\n",
       "      <td>0.643564</td>\n",
       "      <td>368.0</td>\n",
       "      <td>9.029210</td>\n",
       "      <td>1.821782</td>\n",
       "      <td>179.0</td>\n",
       "      <td>-1.251035</td>\n",
       "      <td>0.886139</td>\n",
       "      <td>202.0</td>\n",
       "      <td>18.384776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5052</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043188</td>\n",
       "      <td>226.0</td>\n",
       "      <td>-0.183324</td>\n",
       "      <td>0.969957</td>\n",
       "      <td>413.0</td>\n",
       "      <td>4.714045</td>\n",
       "      <td>1.772532</td>\n",
       "      <td>184.0</td>\n",
       "      <td>-1.283268</td>\n",
       "      <td>0.789700</td>\n",
       "      <td>390.0</td>\n",
       "      <td>4.111695</td>\n",
       "      <td>1.673820</td>\n",
       "      <td>182.0</td>\n",
       "      <td>-1.335646</td>\n",
       "      <td>0.781116</td>\n",
       "      <td>233.0</td>\n",
       "      <td>38.183766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5349</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043485</td>\n",
       "      <td>174.0</td>\n",
       "      <td>0.515997</td>\n",
       "      <td>1.084112</td>\n",
       "      <td>235.0</td>\n",
       "      <td>2.847538</td>\n",
       "      <td>1.464174</td>\n",
       "      <td>109.0</td>\n",
       "      <td>-1.968432</td>\n",
       "      <td>0.679128</td>\n",
       "      <td>252.0</td>\n",
       "      <td>3.497312</td>\n",
       "      <td>1.570093</td>\n",
       "      <td>131.0</td>\n",
       "      <td>-1.127549</td>\n",
       "      <td>0.816199</td>\n",
       "      <td>160.5</td>\n",
       "      <td>26.162951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6393</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32044529</td>\n",
       "      <td>213.0</td>\n",
       "      <td>-0.215206</td>\n",
       "      <td>0.953020</td>\n",
       "      <td>454.0</td>\n",
       "      <td>4.724293</td>\n",
       "      <td>2.031320</td>\n",
       "      <td>135.0</td>\n",
       "      <td>-1.813883</td>\n",
       "      <td>0.604027</td>\n",
       "      <td>377.0</td>\n",
       "      <td>3.146113</td>\n",
       "      <td>1.686801</td>\n",
       "      <td>226.0</td>\n",
       "      <td>0.051240</td>\n",
       "      <td>1.011186</td>\n",
       "      <td>223.5</td>\n",
       "      <td>48.790368</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       chr  position  11298_0  stdR_11298  Ratio_11298  3403_0  stdR_3403  \\\n",
       "543   chr6  32038679     44.0   -4.164073     0.624113   131.0   9.506658   \n",
       "1141  chr6  32039277     40.0    0.176777     1.025641    85.0   8.131728   \n",
       "1538  chr6  32039674     29.0   -0.252538     0.852941    67.0   1.666752   \n",
       "2526  chr6  32040662     40.0   -2.828427     0.714286   229.0  30.582368   \n",
       "2830  chr6  32040966    178.0    1.331565     1.687204   246.0   2.580481   \n",
       "3803  chr6  32041939    199.0    0.848528     1.137143   287.0   3.959798   \n",
       "4611  chr6  32042747    237.0    0.976481     1.065169   491.0  18.081731   \n",
       "4883  chr6  32043019    189.0   -0.707107     0.935644   342.0   7.614996   \n",
       "5052  chr6  32043188    226.0   -0.183324     0.969957   413.0   4.714045   \n",
       "5349  chr6  32043485    174.0    0.515997     1.084112   235.0   2.847538   \n",
       "6393  chr6  32044529    213.0   -0.215206     0.953020   454.0   4.724293   \n",
       "\n",
       "      Ratio_3403  5416_0  stdR_5416  Ratio_5416  8239_0  stdR_8239  \\\n",
       "543     1.858156    32.0  -6.049691    0.453901   100.0   4.635478   \n",
       "1141    2.179487    36.0  -0.530330    0.923077   108.0  12.197592   \n",
       "1538    1.970588    23.0  -0.555584    0.676471    54.0   1.010153   \n",
       "2526    4.089286    22.0  -6.010408    0.392857   135.0  13.965359   \n",
       "2830    2.331754    98.0  -0.137748    0.928910   217.0   2.047855   \n",
       "3803    1.640000   110.0  -2.298097    0.628571   371.0   6.929646   \n",
       "4611    2.206742   150.0  -4.882404    0.674157   354.0   8.855671   \n",
       "4883    1.693069   130.0  -3.916284    0.643564   368.0   9.029210   \n",
       "5052    1.772532   184.0  -1.283268    0.789700   390.0   4.111695   \n",
       "5349    1.464174   109.0  -1.968432    0.679128   252.0   3.497312   \n",
       "6393    2.031320   135.0  -1.813883    0.604027   377.0   3.146113   \n",
       "\n",
       "      Ratio_8239  9773_0  stdR_9773  Ratio_9773    avg        std  \n",
       "543     1.418440    53.0  -2.749860    0.751773   70.5   6.363961  \n",
       "1141    2.769231    37.0  -0.353553    0.948718   39.0   5.656854  \n",
       "1538    1.588235    43.0   0.454569    1.264706   34.0  19.798990  \n",
       "2526    2.410714    52.0  -0.707107    0.928571   56.0   5.656854  \n",
       "2830    2.056872   113.0   0.137748    1.071090  105.5  54.447222  \n",
       "3803    2.120000   180.0   0.176777    1.028571  175.0  28.284271  \n",
       "4611    1.591011   198.0  -1.649916    0.889888  222.5  14.849242  \n",
       "4883    1.821782   179.0  -1.251035    0.886139  202.0  18.384776  \n",
       "5052    1.673820   182.0  -1.335646    0.781116  233.0  38.183766  \n",
       "5349    1.570093   131.0  -1.127549    0.816199  160.5  26.162951  \n",
       "6393    1.686801   226.0   0.051240    1.011186  223.5  48.790368  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def judge_range(df):\n",
    "    for num, colName in enumerate(df.iloc[:, [2,4,6,8,10]].columns):\n",
    "        name = colName.split('_')[0]\n",
    "        df.insert(4 + num*3, 'Ratio_' + name, (df[colName] / df['avg']))\n",
    "    return df \n",
    "\n",
    "filtered_fixed_ratio = judge_range(filtered_fixed)\n",
    "filtered_fixed_ratio"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "acd6f139-c046-4635-993b-90c1340574ca",
   "metadata": {},
   "source": [
    "### ratio mean"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "d7404a16-dbd7-4099-85e2-1b0773af8f37",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ratio_mean_11298 = filtered_fixed_ratio['Ratio_11298'].mean()\n",
    "ratio_mean_3403 = filtered_fixed_ratio['Ratio_3403'].mean()\n",
    "ratio_mean_5416 = filtered_fixed_ratio['Ratio_5416'].mean()\n",
    "ratio_mean_8239 = filtered_fixed_ratio['Ratio_8239'].mean()\n",
    "ratio_mean_9773 = filtered_fixed_ratio['Ratio_9773'].mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eec6bcce-538a-410c-87eb-aced4d7dfe95",
   "metadata": {},
   "source": [
    "### newDepth"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "13240b1b-1e63-40e5-affc-dd88969fcfea",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>NewD_11298</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>NewD_3403</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>NewD_5416</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>NewD_9412</th>\n",
       "      <th>9412_0</th>\n",
       "      <th>NewD_9562</th>\n",
       "      <th>9562_0</th>\n",
       "      <th>NewD_8239</th>\n",
       "      <th>9773_0</th>\n",
       "      <th>NewD_9773</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038136</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.991089</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.946762</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.239755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038137</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.991089</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.946762</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.239755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038138</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.991089</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.946762</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.239755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038139</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.991089</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.946762</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.239755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038140</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.991089</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.946762</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.239755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8194</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038070</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.593664</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8195</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038071</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.593664</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8196</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038072</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.593664</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8197</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038073</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.593664</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8198</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038074</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.593664</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8199 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       chr  position  11298_0  NewD_11298  3403_0  NewD_3403  5416_0  \\\n",
       "0     chr6  32038136      2.0    1.991089     2.0   0.946762     0.0   \n",
       "1     chr6  32038137      2.0    1.991089     2.0   0.946762     0.0   \n",
       "2     chr6  32038138      2.0    1.991089     2.0   0.946762     0.0   \n",
       "3     chr6  32038139      2.0    1.991089     2.0   0.946762     0.0   \n",
       "4     chr6  32038140      2.0    1.991089     2.0   0.946762     0.0   \n",
       "...    ...       ...      ...         ...     ...        ...     ...   \n",
       "8194  chr6  32038070      0.0    0.000000     0.0   0.000000     0.0   \n",
       "8195  chr6  32038071      0.0    0.000000     0.0   0.000000     0.0   \n",
       "8196  chr6  32038072      0.0    0.000000     0.0   0.000000     0.0   \n",
       "8197  chr6  32038073      0.0    0.000000     0.0   0.000000     0.0   \n",
       "8198  chr6  32038074      0.0    0.000000     0.0   0.000000     0.0   \n",
       "\n",
       "      NewD_5416  8239_0  NewD_9412  9412_0  NewD_9562  9562_0  NewD_8239  \\\n",
       "0           0.0     0.0        1.0     1.0        5.0     5.0   0.000000   \n",
       "1           0.0     0.0        1.0     1.0        5.0     5.0   0.000000   \n",
       "2           0.0     0.0        1.0     1.0        5.0     5.0   0.000000   \n",
       "3           0.0     0.0        1.0     1.0        5.0     5.0   0.000000   \n",
       "4           0.0     0.0        1.0     1.0        5.0     5.0   0.000000   \n",
       "...         ...     ...        ...     ...        ...     ...        ...   \n",
       "8194        0.0     3.0        0.0     0.0        2.0     2.0   1.593664   \n",
       "8195        0.0     3.0        0.0     0.0        2.0     2.0   1.593664   \n",
       "8196        0.0     3.0        0.0     0.0        2.0     2.0   1.593664   \n",
       "8197        0.0     3.0        0.0     0.0        2.0     2.0   1.593664   \n",
       "8198        0.0     3.0        0.0     0.0        2.0     2.0   1.593664   \n",
       "\n",
       "      9773_0  NewD_9773  \n",
       "0        4.0   4.239755  \n",
       "1        4.0   4.239755  \n",
       "2        4.0   4.239755  \n",
       "3        4.0   4.239755  \n",
       "4        4.0   4.239755  \n",
       "...      ...        ...  \n",
       "8194     0.0   0.000000  \n",
       "8195     0.0   0.000000  \n",
       "8196     0.0   0.000000  \n",
       "8197     0.0   0.000000  \n",
       "8198     0.0   0.000000  \n",
       "\n",
       "[8199 rows x 16 columns]"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Path_2rd_3rd_dir = \"/lustre/home/acct-medfzx/medfzx-lkw/project/2rd_NGS_annovar_LD/result/Patient_WES_have_hifi/bam\"\n",
    "merged_df_23 = get_data(Path_2rd_3rd_dir, MQ=0)\n",
    "merged_df_23 = get_standard_avg_std(merged_df_23)\n",
    "\n",
    "merged_df_23.insert(3, 'NewD_11298', (merged_df_23['11298_0'] / ratio_mean_11298 ))\n",
    "merged_df_23.insert(5, 'NewD_3403', (merged_df_23['3403_0'] / ratio_mean_3403 ))\n",
    "merged_df_23.insert(7, 'NewD_5416', (merged_df_23['5416_0'] / ratio_mean_5416 ))\n",
    "merged_df_23.insert(9, 'NewD_9412', (merged_df_23['9412_0'] ))\n",
    "merged_df_23.insert(11, 'NewD_9562', (merged_df_23['9562_0'] ))\n",
    "merged_df_23.insert(13, 'NewD_8239', (merged_df_23['8239_0'] / ratio_mean_8239 ))\n",
    "merged_df_23.insert(15, 'NewD_9773', (merged_df_23['9773_0'] / ratio_mean_9773 ))\n",
    "del merged_df_23['avg']\n",
    "del merged_df_23['std']\n",
    "merged_df_23\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "525dbbf4-4c51-4bf1-8c2f-0acb55898f62",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(14, 9)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_3986148/130368588.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['avg'] = df.iloc[:, 5:7].mean(axis=1)\n",
      "/tmp/ipykernel_3986148/130368588.py:3: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['std'] = df.iloc[:, 5:7].std(axis=1)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>NewD_11298</th>\n",
       "      <th>NewD_3403</th>\n",
       "      <th>NewD_5416</th>\n",
       "      <th>NewD_9412</th>\n",
       "      <th>NewD_9562</th>\n",
       "      <th>NewD_8239</th>\n",
       "      <th>NewD_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>108.514354</td>\n",
       "      <td>90.415726</td>\n",
       "      <td>78.843848</td>\n",
       "      <td>122.0</td>\n",
       "      <td>55.0</td>\n",
       "      <td>79.151979</td>\n",
       "      <td>50.877066</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>42.808415</td>\n",
       "      <td>40.710746</td>\n",
       "      <td>37.190495</td>\n",
       "      <td>58.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>41.435264</td>\n",
       "      <td>47.697249</td>\n",
       "      <td>51.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>6.968812</td>\n",
       "      <td>31.716511</td>\n",
       "      <td>31.240015</td>\n",
       "      <td>62.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>51.528470</td>\n",
       "      <td>52.996944</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>61.723761</td>\n",
       "      <td>42.130888</td>\n",
       "      <td>44.628593</td>\n",
       "      <td>33.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>36.654272</td>\n",
       "      <td>82.675232</td>\n",
       "      <td>39.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>19.910891</td>\n",
       "      <td>36.450319</td>\n",
       "      <td>56.529552</td>\n",
       "      <td>56.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>36.123051</td>\n",
       "      <td>41.337616</td>\n",
       "      <td>40.0</td>\n",
       "      <td>22.627417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>42.808415</td>\n",
       "      <td>29.822988</td>\n",
       "      <td>43.140974</td>\n",
       "      <td>52.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>38.247936</td>\n",
       "      <td>46.637310</td>\n",
       "      <td>45.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>52.763860</td>\n",
       "      <td>31.243130</td>\n",
       "      <td>44.628593</td>\n",
       "      <td>68.0</td>\n",
       "      <td>65.0</td>\n",
       "      <td>55.247019</td>\n",
       "      <td>95.394498</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040400</td>\n",
       "      <td>31.857425</td>\n",
       "      <td>37.870461</td>\n",
       "      <td>28.264776</td>\n",
       "      <td>50.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>53.653355</td>\n",
       "      <td>47.697249</td>\n",
       "      <td>35.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040584</td>\n",
       "      <td>57.741583</td>\n",
       "      <td>90.889107</td>\n",
       "      <td>37.190495</td>\n",
       "      <td>84.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>75.964651</td>\n",
       "      <td>75.255660</td>\n",
       "      <td>63.5</td>\n",
       "      <td>28.991378</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040750</td>\n",
       "      <td>78.648018</td>\n",
       "      <td>118.345191</td>\n",
       "      <td>84.794328</td>\n",
       "      <td>91.0</td>\n",
       "      <td>57.0</td>\n",
       "      <td>95.088619</td>\n",
       "      <td>74.195721</td>\n",
       "      <td>74.0</td>\n",
       "      <td>24.041631</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>66.701484</td>\n",
       "      <td>21.302134</td>\n",
       "      <td>52.066692</td>\n",
       "      <td>50.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>40.372822</td>\n",
       "      <td>71.015904</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>325.543061</td>\n",
       "      <td>119.291952</td>\n",
       "      <td>154.712457</td>\n",
       "      <td>183.0</td>\n",
       "      <td>193.0</td>\n",
       "      <td>282.609751</td>\n",
       "      <td>239.546185</td>\n",
       "      <td>188.0</td>\n",
       "      <td>7.071068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>264.814845</td>\n",
       "      <td>64.853165</td>\n",
       "      <td>89.257187</td>\n",
       "      <td>170.0</td>\n",
       "      <td>201.0</td>\n",
       "      <td>173.178156</td>\n",
       "      <td>219.407346</td>\n",
       "      <td>185.5</td>\n",
       "      <td>21.920310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>389.257911</td>\n",
       "      <td>333.260058</td>\n",
       "      <td>464.137372</td>\n",
       "      <td>436.0</td>\n",
       "      <td>315.0</td>\n",
       "      <td>389.385239</td>\n",
       "      <td>384.757810</td>\n",
       "      <td>375.5</td>\n",
       "      <td>85.559921</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  NewD_11298   NewD_3403   NewD_5416  NewD_9412  NewD_9562  \\\n",
       "1    chr6  32038557  108.514354   90.415726   78.843848      122.0       55.0   \n",
       "2    chr6  32038800   42.808415   40.710746   37.190495       58.0       45.0   \n",
       "3    chr6  32039143    6.968812   31.716511   31.240015       62.0       40.0   \n",
       "4    chr6  32039425   61.723761   42.130888   44.628593       33.0       45.0   \n",
       "5    chr6  32039555   19.910891   36.450319   56.529552       56.0       24.0   \n",
       "6    chr6  32039801   42.808415   29.822988   43.140974       52.0       39.0   \n",
       "7    chr6  32040110   52.763860   31.243130   44.628593       68.0       65.0   \n",
       "8    chr6  32040400   31.857425   37.870461   28.264776       50.0       20.0   \n",
       "8-2  chr6  32040584   57.741583   90.889107   37.190495       84.0       43.0   \n",
       "9    chr6  32040750   78.648018  118.345191   84.794328       91.0       57.0   \n",
       "10   chr6  32041480   66.701484   21.302134   52.066692       50.0       35.0   \n",
       "40   chr6  32042500  325.543061  119.291952  154.712457      183.0      193.0   \n",
       "35   chr6  32043800  264.814845   64.853165   89.257187      170.0      201.0   \n",
       "32   chr6  32045150  389.257911  333.260058  464.137372      436.0      315.0   \n",
       "\n",
       "      NewD_8239   NewD_9773    avg        std  \n",
       "1     79.151979   50.877066   88.5  47.376154  \n",
       "2     41.435264   47.697249   51.5   9.192388  \n",
       "3     51.528470   52.996944   51.0  15.556349  \n",
       "4     36.654272   82.675232   39.0   8.485281  \n",
       "5     36.123051   41.337616   40.0  22.627417  \n",
       "6     38.247936   46.637310   45.5   9.192388  \n",
       "7     55.247019   95.394498   66.5   2.121320  \n",
       "8     53.653355   47.697249   35.0  21.213203  \n",
       "8-2   75.964651   75.255660   63.5  28.991378  \n",
       "9     95.088619   74.195721   74.0  24.041631  \n",
       "10    40.372822   71.015904   42.5  10.606602  \n",
       "40   282.609751  239.546185  188.0   7.071068  \n",
       "35   173.178156  219.407346  185.5  21.920310  \n",
       "32   389.385239  384.757810  375.5  85.559921  "
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def get_standard_avg_std2(df):   # 计算各行的均值和标准差（从第3列开始）\n",
    "    df['avg'] = df.iloc[:, 5:7].mean(axis=1)\n",
    "    df['std'] = df.iloc[:, 5:7].std(axis=1)\n",
    "    return df\n",
    "\n",
    "df = merged_df_23.iloc[:, [0,1,3,5,7,9,11,13,15]]\n",
    "target_positions = [32038557, 32038800, 32039143, 32039425, 32039555, 32039801, 32040110, 32040400, 32040584, 32040750, 32041480, 32042500, 32043800, 32045150, ]\n",
    "filtered_rows = df[df['position'].isin(target_positions)]\n",
    "exonListName = ['1', '2', '3', '4', '5', '6', '7', '8', '8-2', '9', '10', '40', '35', '32']\n",
    "filtered_rows.index = exonListName\n",
    "print(filtered_rows.shape)\n",
    "filtered_rows = get_standard_avg_std2(filtered_rows)\n",
    "filtered_rows"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f94e0222-ea53-41bb-968c-ba9e066c8537",
   "metadata": {},
   "source": [
    "### newRatio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "3585519c-db3c-4de1-bb30-6e9bd3afa912",
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "cannot insert NRatio_11298, already exists",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m/tmp/ipykernel_3986148/2213921097.py\u001b[0m in \u001b[0;36m?\u001b[0;34m()\u001b[0m\n\u001b[1;32m      3\u001b[0m         \u001b[0mname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcolName\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'_'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m         \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minsert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mnum\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'NRatio_'\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcolName\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'avg'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m     \u001b[0;32mreturn\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfiltered_fixed_ratio\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnewRatio\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfiltered_rows\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      8\u001b[0m \u001b[0mfiltered_fixed_ratio\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/tmp/ipykernel_3986148/2213921097.py\u001b[0m in \u001b[0;36m?\u001b[0;34m(df)\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mnewRatio\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m     \u001b[0;32mfor\u001b[0m \u001b[0mnum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcolName\u001b[0m \u001b[0;32min\u001b[0m \u001b[0menumerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miloc\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m         \u001b[0mname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcolName\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'_'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m         \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minsert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mnum\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'NRatio_'\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcolName\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'avg'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      5\u001b[0m     \u001b[0;32mreturn\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/miniforge3/envs/karl/lib/python3.12/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m?\u001b[0;34m(self, loc, column, value, allow_duplicates)\u001b[0m\n\u001b[1;32m   5154\u001b[0m                 \u001b[0;34m\"'self.flags.allows_duplicate_labels' is False.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5155\u001b[0m             \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5156\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mallow_duplicates\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mcolumn\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5157\u001b[0m             \u001b[0;31m# Should this be a different kind of error??\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5158\u001b[0;31m             \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"\u001b[0m\u001b[0;34mcannot insert \u001b[0m\u001b[0;34m{\u001b[0m\u001b[0mcolumn\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m, already exists\u001b[0m\u001b[0;34m\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   5159\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mis_integer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mloc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5160\u001b[0m             \u001b[0;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"loc must be int\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5161\u001b[0m         \u001b[0;31m# convert non stdlib ints to satisfy typing checks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mValueError\u001b[0m: cannot insert NRatio_11298, already exists"
     ]
    }
   ],
   "source": [
    "def newRatio(df):\n",
    "    for num, colName in enumerate(df.iloc[:, 2:-2].columns):\n",
    "        name = colName.split('_')[1]\n",
    "        df.insert(3 + num*2, 'NRatio_' + name, (df[colName] / df['avg']))\n",
    "    return df \n",
    "\n",
    "filtered_fixed_ratio = newRatio(filtered_rows)\n",
    "filtered_fixed_ratio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "57be57cb-c67a-4405-bbf1-11ec83cb594c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>NewD_11298</th>\n",
       "      <th>NRatio_11298</th>\n",
       "      <th>NewD_3403</th>\n",
       "      <th>NRatio_3403</th>\n",
       "      <th>NewD_5416</th>\n",
       "      <th>NRatio_5416</th>\n",
       "      <th>NewD_9412</th>\n",
       "      <th>NRatio_9412</th>\n",
       "      <th>NewD_9562</th>\n",
       "      <th>NRatio_9562</th>\n",
       "      <th>NewD_8239</th>\n",
       "      <th>NRatio_8239</th>\n",
       "      <th>NewD_9773</th>\n",
       "      <th>NRatio_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>108.514354</td>\n",
       "      <td>1.226151</td>\n",
       "      <td>90.415726</td>\n",
       "      <td>1.021647</td>\n",
       "      <td>78.843848</td>\n",
       "      <td>0.890891</td>\n",
       "      <td>122.0</td>\n",
       "      <td>1.378531</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0.621469</td>\n",
       "      <td>79.151979</td>\n",
       "      <td>0.894373</td>\n",
       "      <td>50.877066</td>\n",
       "      <td>0.574882</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>42.808415</td>\n",
       "      <td>0.831231</td>\n",
       "      <td>40.710746</td>\n",
       "      <td>0.790500</td>\n",
       "      <td>37.190495</td>\n",
       "      <td>0.722146</td>\n",
       "      <td>58.0</td>\n",
       "      <td>1.126214</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.873786</td>\n",
       "      <td>41.435264</td>\n",
       "      <td>0.804568</td>\n",
       "      <td>47.697249</td>\n",
       "      <td>0.926160</td>\n",
       "      <td>51.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>6.968812</td>\n",
       "      <td>0.136643</td>\n",
       "      <td>31.716511</td>\n",
       "      <td>0.621892</td>\n",
       "      <td>31.240015</td>\n",
       "      <td>0.612549</td>\n",
       "      <td>62.0</td>\n",
       "      <td>1.215686</td>\n",
       "      <td>40.0</td>\n",
       "      <td>0.784314</td>\n",
       "      <td>51.528470</td>\n",
       "      <td>1.010362</td>\n",
       "      <td>52.996944</td>\n",
       "      <td>1.039156</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>61.723761</td>\n",
       "      <td>1.582661</td>\n",
       "      <td>42.130888</td>\n",
       "      <td>1.080279</td>\n",
       "      <td>44.628593</td>\n",
       "      <td>1.144323</td>\n",
       "      <td>33.0</td>\n",
       "      <td>0.846154</td>\n",
       "      <td>45.0</td>\n",
       "      <td>1.153846</td>\n",
       "      <td>36.654272</td>\n",
       "      <td>0.939853</td>\n",
       "      <td>82.675232</td>\n",
       "      <td>2.119878</td>\n",
       "      <td>39.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>19.910891</td>\n",
       "      <td>0.497772</td>\n",
       "      <td>36.450319</td>\n",
       "      <td>0.911258</td>\n",
       "      <td>56.529552</td>\n",
       "      <td>1.413239</td>\n",
       "      <td>56.0</td>\n",
       "      <td>1.400000</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0.600000</td>\n",
       "      <td>36.123051</td>\n",
       "      <td>0.903076</td>\n",
       "      <td>41.337616</td>\n",
       "      <td>1.033440</td>\n",
       "      <td>40.0</td>\n",
       "      <td>22.627417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>42.808415</td>\n",
       "      <td>0.940844</td>\n",
       "      <td>29.822988</td>\n",
       "      <td>0.655450</td>\n",
       "      <td>43.140974</td>\n",
       "      <td>0.948153</td>\n",
       "      <td>52.0</td>\n",
       "      <td>1.142857</td>\n",
       "      <td>39.0</td>\n",
       "      <td>0.857143</td>\n",
       "      <td>38.247936</td>\n",
       "      <td>0.840614</td>\n",
       "      <td>46.637310</td>\n",
       "      <td>1.024996</td>\n",
       "      <td>45.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>52.763860</td>\n",
       "      <td>0.793442</td>\n",
       "      <td>31.243130</td>\n",
       "      <td>0.469822</td>\n",
       "      <td>44.628593</td>\n",
       "      <td>0.671107</td>\n",
       "      <td>68.0</td>\n",
       "      <td>1.022556</td>\n",
       "      <td>65.0</td>\n",
       "      <td>0.977444</td>\n",
       "      <td>55.247019</td>\n",
       "      <td>0.830782</td>\n",
       "      <td>95.394498</td>\n",
       "      <td>1.434504</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040400</td>\n",
       "      <td>31.857425</td>\n",
       "      <td>0.910212</td>\n",
       "      <td>37.870461</td>\n",
       "      <td>1.082013</td>\n",
       "      <td>28.264776</td>\n",
       "      <td>0.807565</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1.428571</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0.571429</td>\n",
       "      <td>53.653355</td>\n",
       "      <td>1.532953</td>\n",
       "      <td>47.697249</td>\n",
       "      <td>1.362779</td>\n",
       "      <td>35.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040584</td>\n",
       "      <td>57.741583</td>\n",
       "      <td>0.909316</td>\n",
       "      <td>90.889107</td>\n",
       "      <td>1.431325</td>\n",
       "      <td>37.190495</td>\n",
       "      <td>0.585677</td>\n",
       "      <td>84.0</td>\n",
       "      <td>1.322835</td>\n",
       "      <td>43.0</td>\n",
       "      <td>0.677165</td>\n",
       "      <td>75.964651</td>\n",
       "      <td>1.196294</td>\n",
       "      <td>75.255660</td>\n",
       "      <td>1.185129</td>\n",
       "      <td>63.5</td>\n",
       "      <td>28.991378</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040750</td>\n",
       "      <td>78.648018</td>\n",
       "      <td>1.062811</td>\n",
       "      <td>118.345191</td>\n",
       "      <td>1.599259</td>\n",
       "      <td>84.794328</td>\n",
       "      <td>1.145869</td>\n",
       "      <td>91.0</td>\n",
       "      <td>1.229730</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0.770270</td>\n",
       "      <td>95.088619</td>\n",
       "      <td>1.284981</td>\n",
       "      <td>74.195721</td>\n",
       "      <td>1.002645</td>\n",
       "      <td>74.0</td>\n",
       "      <td>24.041631</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>66.701484</td>\n",
       "      <td>1.569447</td>\n",
       "      <td>21.302134</td>\n",
       "      <td>0.501227</td>\n",
       "      <td>52.066692</td>\n",
       "      <td>1.225099</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1.176471</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0.823529</td>\n",
       "      <td>40.372822</td>\n",
       "      <td>0.949949</td>\n",
       "      <td>71.015904</td>\n",
       "      <td>1.670962</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>325.543061</td>\n",
       "      <td>1.731612</td>\n",
       "      <td>119.291952</td>\n",
       "      <td>0.634532</td>\n",
       "      <td>154.712457</td>\n",
       "      <td>0.822939</td>\n",
       "      <td>183.0</td>\n",
       "      <td>0.973404</td>\n",
       "      <td>193.0</td>\n",
       "      <td>1.026596</td>\n",
       "      <td>282.609751</td>\n",
       "      <td>1.503243</td>\n",
       "      <td>239.546185</td>\n",
       "      <td>1.274182</td>\n",
       "      <td>188.0</td>\n",
       "      <td>7.071068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>264.814845</td>\n",
       "      <td>1.427573</td>\n",
       "      <td>64.853165</td>\n",
       "      <td>0.349613</td>\n",
       "      <td>89.257187</td>\n",
       "      <td>0.481171</td>\n",
       "      <td>170.0</td>\n",
       "      <td>0.916442</td>\n",
       "      <td>201.0</td>\n",
       "      <td>1.083558</td>\n",
       "      <td>173.178156</td>\n",
       "      <td>0.933575</td>\n",
       "      <td>219.407346</td>\n",
       "      <td>1.182789</td>\n",
       "      <td>185.5</td>\n",
       "      <td>21.920310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>389.257911</td>\n",
       "      <td>1.036639</td>\n",
       "      <td>333.260058</td>\n",
       "      <td>0.887510</td>\n",
       "      <td>464.137372</td>\n",
       "      <td>1.236052</td>\n",
       "      <td>436.0</td>\n",
       "      <td>1.161119</td>\n",
       "      <td>315.0</td>\n",
       "      <td>0.838881</td>\n",
       "      <td>389.385239</td>\n",
       "      <td>1.036978</td>\n",
       "      <td>384.757810</td>\n",
       "      <td>1.024655</td>\n",
       "      <td>375.5</td>\n",
       "      <td>85.559921</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  NewD_11298  NRatio_11298   NewD_3403  NRatio_3403  \\\n",
       "1    chr6  32038557  108.514354      1.226151   90.415726     1.021647   \n",
       "2    chr6  32038800   42.808415      0.831231   40.710746     0.790500   \n",
       "3    chr6  32039143    6.968812      0.136643   31.716511     0.621892   \n",
       "4    chr6  32039425   61.723761      1.582661   42.130888     1.080279   \n",
       "5    chr6  32039555   19.910891      0.497772   36.450319     0.911258   \n",
       "6    chr6  32039801   42.808415      0.940844   29.822988     0.655450   \n",
       "7    chr6  32040110   52.763860      0.793442   31.243130     0.469822   \n",
       "8    chr6  32040400   31.857425      0.910212   37.870461     1.082013   \n",
       "8-2  chr6  32040584   57.741583      0.909316   90.889107     1.431325   \n",
       "9    chr6  32040750   78.648018      1.062811  118.345191     1.599259   \n",
       "10   chr6  32041480   66.701484      1.569447   21.302134     0.501227   \n",
       "40   chr6  32042500  325.543061      1.731612  119.291952     0.634532   \n",
       "35   chr6  32043800  264.814845      1.427573   64.853165     0.349613   \n",
       "32   chr6  32045150  389.257911      1.036639  333.260058     0.887510   \n",
       "\n",
       "      NewD_5416  NRatio_5416  NewD_9412  NRatio_9412  NewD_9562  NRatio_9562  \\\n",
       "1     78.843848     0.890891      122.0     1.378531       55.0     0.621469   \n",
       "2     37.190495     0.722146       58.0     1.126214       45.0     0.873786   \n",
       "3     31.240015     0.612549       62.0     1.215686       40.0     0.784314   \n",
       "4     44.628593     1.144323       33.0     0.846154       45.0     1.153846   \n",
       "5     56.529552     1.413239       56.0     1.400000       24.0     0.600000   \n",
       "6     43.140974     0.948153       52.0     1.142857       39.0     0.857143   \n",
       "7     44.628593     0.671107       68.0     1.022556       65.0     0.977444   \n",
       "8     28.264776     0.807565       50.0     1.428571       20.0     0.571429   \n",
       "8-2   37.190495     0.585677       84.0     1.322835       43.0     0.677165   \n",
       "9     84.794328     1.145869       91.0     1.229730       57.0     0.770270   \n",
       "10    52.066692     1.225099       50.0     1.176471       35.0     0.823529   \n",
       "40   154.712457     0.822939      183.0     0.973404      193.0     1.026596   \n",
       "35    89.257187     0.481171      170.0     0.916442      201.0     1.083558   \n",
       "32   464.137372     1.236052      436.0     1.161119      315.0     0.838881   \n",
       "\n",
       "      NewD_8239  NRatio_8239   NewD_9773  NRatio_9773    avg        std  \n",
       "1     79.151979     0.894373   50.877066     0.574882   88.5  47.376154  \n",
       "2     41.435264     0.804568   47.697249     0.926160   51.5   9.192388  \n",
       "3     51.528470     1.010362   52.996944     1.039156   51.0  15.556349  \n",
       "4     36.654272     0.939853   82.675232     2.119878   39.0   8.485281  \n",
       "5     36.123051     0.903076   41.337616     1.033440   40.0  22.627417  \n",
       "6     38.247936     0.840614   46.637310     1.024996   45.5   9.192388  \n",
       "7     55.247019     0.830782   95.394498     1.434504   66.5   2.121320  \n",
       "8     53.653355     1.532953   47.697249     1.362779   35.0  21.213203  \n",
       "8-2   75.964651     1.196294   75.255660     1.185129   63.5  28.991378  \n",
       "9     95.088619     1.284981   74.195721     1.002645   74.0  24.041631  \n",
       "10    40.372822     0.949949   71.015904     1.670962   42.5  10.606602  \n",
       "40   282.609751     1.503243  239.546185     1.274182  188.0   7.071068  \n",
       "35   173.178156     0.933575  219.407346     1.182789  185.5  21.920310  \n",
       "32   389.385239     1.036978  384.757810     1.024655  375.5  85.559921  "
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_rows"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f773b40-0882-4c24-8316-60472d6ab39b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "a0f28f04-e93d-4896-8940-b9e2a73f12c2",
   "metadata": {},
   "source": [
    "# full"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "3ad95721-bc60-48a9-aedc-f7554d8510b2",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n",
      "(14, 18)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_0</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_0</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_0</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_0</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9412_0</th>\n",
       "      <th>stdR_9412</th>\n",
       "      <th>9562_0</th>\n",
       "      <th>stdR_9562</th>\n",
       "      <th>9773_0</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>109.0</td>\n",
       "      <td>0.432707</td>\n",
       "      <td>191.0</td>\n",
       "      <td>2.163536</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-0.749322</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1.277014</td>\n",
       "      <td>122.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>55.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>48.0</td>\n",
       "      <td>-0.854860</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.924678</td>\n",
       "      <td>86.0</td>\n",
       "      <td>3.753105</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-2.882820</td>\n",
       "      <td>78.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>58.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>51.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>7.0</td>\n",
       "      <td>-2.828427</td>\n",
       "      <td>67.0</td>\n",
       "      <td>1.028519</td>\n",
       "      <td>21.0</td>\n",
       "      <td>-1.928473</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.956992</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-0.064282</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>62.0</td>\n",
       "      <td>2.710576</td>\n",
       "      <td>89.0</td>\n",
       "      <td>5.892557</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>69.0</td>\n",
       "      <td>3.535534</td>\n",
       "      <td>33.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>78.0</td>\n",
       "      <td>4.596194</td>\n",
       "      <td>39.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-0.883883</td>\n",
       "      <td>77.0</td>\n",
       "      <td>1.635184</td>\n",
       "      <td>38.0</td>\n",
       "      <td>-0.088388</td>\n",
       "      <td>68.0</td>\n",
       "      <td>1.237437</td>\n",
       "      <td>56.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.044194</td>\n",
       "      <td>40.0</td>\n",
       "      <td>22.627417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.271964</td>\n",
       "      <td>63.0</td>\n",
       "      <td>1.903749</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-1.794963</td>\n",
       "      <td>72.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-0.163178</td>\n",
       "      <td>45.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-6.363961</td>\n",
       "      <td>66.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-17.206265</td>\n",
       "      <td>104.0</td>\n",
       "      <td>17.677670</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>65.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>90.0</td>\n",
       "      <td>11.078006</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040421</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.047140</td>\n",
       "      <td>92.0</td>\n",
       "      <td>2.451304</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>142.0</td>\n",
       "      <td>4.808326</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>66.0</td>\n",
       "      <td>1.225652</td>\n",
       "      <td>40.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040533</td>\n",
       "      <td>74.0</td>\n",
       "      <td>0.066291</td>\n",
       "      <td>188.0</td>\n",
       "      <td>2.585359</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>197.0</td>\n",
       "      <td>2.784233</td>\n",
       "      <td>103.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>89.0</td>\n",
       "      <td>0.397748</td>\n",
       "      <td>71.0</td>\n",
       "      <td>45.254834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041111</td>\n",
       "      <td>87.0</td>\n",
       "      <td>-0.291162</td>\n",
       "      <td>168.0</td>\n",
       "      <td>6.447150</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-3.369156</td>\n",
       "      <td>266.0</td>\n",
       "      <td>14.599675</td>\n",
       "      <td>82.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>107.0</td>\n",
       "      <td>1.372619</td>\n",
       "      <td>90.5</td>\n",
       "      <td>12.020815</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.235702</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3.158410</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>327.0</td>\n",
       "      <td>19.657569</td>\n",
       "      <td>252.0</td>\n",
       "      <td>9.050967</td>\n",
       "      <td>104.0</td>\n",
       "      <td>-11.879394</td>\n",
       "      <td>532.0</td>\n",
       "      <td>48.648947</td>\n",
       "      <td>183.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>193.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>226.0</td>\n",
       "      <td>5.374012</td>\n",
       "      <td>188.0</td>\n",
       "      <td>7.071068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>266.0</td>\n",
       "      <td>3.672393</td>\n",
       "      <td>137.0</td>\n",
       "      <td>-2.212560</td>\n",
       "      <td>60.0</td>\n",
       "      <td>-5.725284</td>\n",
       "      <td>326.0</td>\n",
       "      <td>6.409581</td>\n",
       "      <td>170.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>201.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>207.0</td>\n",
       "      <td>0.980826</td>\n",
       "      <td>185.5</td>\n",
       "      <td>21.920310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>391.0</td>\n",
       "      <td>0.181160</td>\n",
       "      <td>704.0</td>\n",
       "      <td>3.839415</td>\n",
       "      <td>312.0</td>\n",
       "      <td>-0.742170</td>\n",
       "      <td>733.0</td>\n",
       "      <td>4.178358</td>\n",
       "      <td>436.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>315.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>363.0</td>\n",
       "      <td>-0.146096</td>\n",
       "      <td>375.5</td>\n",
       "      <td>85.559921</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  11298_0  stdR_11298  3403_0  stdR_3403  5416_0  \\\n",
       "1    chr6  32038557    109.0    0.432707   191.0   2.163536    53.0   \n",
       "2    chr6  32038800     43.0   -0.924678    86.0   3.753105    25.0   \n",
       "3    chr6  32039143      7.0   -2.828427    67.0   1.028519    21.0   \n",
       "4    chr6  32039425     62.0    2.710576    89.0   5.892557    30.0   \n",
       "5    chr6  32039555     20.0   -0.883883    77.0   1.635184    38.0   \n",
       "6    chr6  32039801     43.0   -0.271964    63.0   1.903749    29.0   \n",
       "7    chr6  32040110     53.0   -6.363961    66.0  -0.235702    30.0   \n",
       "8    chr6  32040421     39.0   -0.047140    92.0   2.451304    25.0   \n",
       "8-2  chr6  32040533     74.0    0.066291   188.0   2.585359    23.0   \n",
       "9    chr6  32041111     87.0   -0.291162   168.0   6.447150    50.0   \n",
       "10   chr6  32041480     67.0    2.309882    45.0   0.235702    35.0   \n",
       "40   chr6  32042500    327.0   19.657569   252.0   9.050967   104.0   \n",
       "35   chr6  32043800    266.0    3.672393   137.0  -2.212560    60.0   \n",
       "32   chr6  32045150    391.0    0.181160   704.0   3.839415   312.0   \n",
       "\n",
       "     stdR_5416  8239_0  stdR_8239  9412_0  stdR_9412  9562_0  stdR_9562  \\\n",
       "1    -0.749322   149.0   1.277014   122.0   0.707107    55.0  -0.707107   \n",
       "2    -2.882820    78.0   2.882820    58.0   0.707107    45.0  -0.707107   \n",
       "3    -1.928473    97.0   2.956992    62.0   0.707107    40.0  -0.707107   \n",
       "4    -1.060660    69.0   3.535534    33.0  -0.707107    45.0   0.707107   \n",
       "5    -0.088388    68.0   1.237437    56.0   0.707107    24.0  -0.707107   \n",
       "6    -1.794963    72.0   2.882820    52.0   0.707107    39.0  -0.707107   \n",
       "7   -17.206265   104.0  17.677670    68.0   0.707107    65.0  -0.707107   \n",
       "8    -0.707107   142.0   4.808326    55.0   0.707107    25.0  -0.707107   \n",
       "8-2  -1.060660   197.0   2.784233   103.0   0.707107    39.0  -0.707107   \n",
       "9    -3.369156   266.0  14.599675    82.0  -0.707107    99.0   0.707107   \n",
       "10   -0.707107    76.0   3.158410    50.0   0.707107    35.0  -0.707107   \n",
       "40  -11.879394   532.0  48.648947   183.0  -0.707107   193.0   0.707107   \n",
       "35   -5.725284   326.0   6.409581   170.0  -0.707107   201.0   0.707107   \n",
       "32   -0.742170   733.0   4.178358   436.0   0.707107   315.0  -0.707107   \n",
       "\n",
       "     9773_0  stdR_9773    avg        std  \n",
       "1      48.0  -0.854860   88.5  47.376154  \n",
       "2      45.0  -0.707107   51.5   9.192388  \n",
       "3      50.0  -0.064282   51.0  15.556349  \n",
       "4      78.0   4.596194   39.0   8.485281  \n",
       "5      39.0  -0.044194   40.0  22.627417  \n",
       "6      44.0  -0.163178   45.5   9.192388  \n",
       "7      90.0  11.078006   66.5   2.121320  \n",
       "8      66.0   1.225652   40.0  21.213203  \n",
       "8-2    89.0   0.397748   71.0  45.254834  \n",
       "9     107.0   1.372619   90.5  12.020815  \n",
       "10     67.0   2.309882   42.5  10.606602  \n",
       "40    226.0   5.374012  188.0   7.071068  \n",
       "35    207.0   0.980826  185.5  21.920310  \n",
       "32    363.0  -0.146096  375.5  85.559921  "
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os \n",
    "import pandas as pd\n",
    "\n",
    "\n",
    "def get_result(path, MQ=0, position=32039143):\n",
    "    df = get_data(path, MQ=MQ)\n",
    "    df = get_standard_avg_std(df)\n",
    "    df = judge_range(df)\n",
    "    target_positions = [32038557, 32038800, 32039143, 32039425, 32039555, 32039801, 32040110, 32040400, 32040584, 32040750, 32041480, 32042500, 32043800, 32045150]\n",
    "    filtered_rows = df[df['position'].isin(target_positions)]\n",
    "    filtered_rows.index = ['1', '2', '3', '4', '5', '6', '7', '8', '8-2', '9', '10', '40', '35', '32']\n",
    "    print(filtered_rows.shape)\n",
    "    return filtered_rows \n",
    "\n",
    "Path_2rd_3rd_dir = \"/lustre/home/acct-medfzx/medfzx-lkw/project/2rd_NGS_annovar_LD/result/Patient_WES_have_hifi/bam\"\n",
    "MQ = 0\n",
    "position=32039143\n",
    "\n",
    "filtered_df = get_result(Path_2rd_3rd_dir, MQ=0)   # 9412  9562\n",
    "filtered_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "b130e536-55a4-4423-847a-1d5e7fa190ec",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n",
      "(14, 18)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_1</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_1</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_1</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_1</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9412_1</th>\n",
       "      <th>stdR_9412</th>\n",
       "      <th>9562_1</th>\n",
       "      <th>stdR_9562</th>\n",
       "      <th>9773_1</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>109.0</td>\n",
       "      <td>0.432707</td>\n",
       "      <td>191.0</td>\n",
       "      <td>2.163536</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-0.749322</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1.277014</td>\n",
       "      <td>122.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>55.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>48.0</td>\n",
       "      <td>-0.854860</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.924678</td>\n",
       "      <td>86.0</td>\n",
       "      <td>3.753105</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-2.882820</td>\n",
       "      <td>78.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>58.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>51.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>7.0</td>\n",
       "      <td>-2.828427</td>\n",
       "      <td>67.0</td>\n",
       "      <td>1.028519</td>\n",
       "      <td>21.0</td>\n",
       "      <td>-1.928473</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.956992</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-0.064282</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>62.0</td>\n",
       "      <td>2.710576</td>\n",
       "      <td>89.0</td>\n",
       "      <td>5.892557</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>69.0</td>\n",
       "      <td>3.535534</td>\n",
       "      <td>33.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>78.0</td>\n",
       "      <td>4.596194</td>\n",
       "      <td>39.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-0.883883</td>\n",
       "      <td>77.0</td>\n",
       "      <td>1.635184</td>\n",
       "      <td>38.0</td>\n",
       "      <td>-0.088388</td>\n",
       "      <td>68.0</td>\n",
       "      <td>1.237437</td>\n",
       "      <td>56.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.044194</td>\n",
       "      <td>40.0</td>\n",
       "      <td>22.627417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.271964</td>\n",
       "      <td>63.0</td>\n",
       "      <td>1.903749</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-1.794963</td>\n",
       "      <td>72.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-0.163178</td>\n",
       "      <td>45.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-6.363961</td>\n",
       "      <td>66.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-17.206265</td>\n",
       "      <td>104.0</td>\n",
       "      <td>17.677670</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>65.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>90.0</td>\n",
       "      <td>11.078006</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040421</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.047140</td>\n",
       "      <td>92.0</td>\n",
       "      <td>2.451304</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>142.0</td>\n",
       "      <td>4.808326</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>66.0</td>\n",
       "      <td>1.225652</td>\n",
       "      <td>40.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040533</td>\n",
       "      <td>74.0</td>\n",
       "      <td>0.066291</td>\n",
       "      <td>188.0</td>\n",
       "      <td>2.585359</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>197.0</td>\n",
       "      <td>2.784233</td>\n",
       "      <td>103.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>89.0</td>\n",
       "      <td>0.397748</td>\n",
       "      <td>71.0</td>\n",
       "      <td>45.254834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041111</td>\n",
       "      <td>87.0</td>\n",
       "      <td>-0.291162</td>\n",
       "      <td>168.0</td>\n",
       "      <td>6.447150</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-3.369156</td>\n",
       "      <td>266.0</td>\n",
       "      <td>14.599675</td>\n",
       "      <td>82.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>107.0</td>\n",
       "      <td>1.372619</td>\n",
       "      <td>90.5</td>\n",
       "      <td>12.020815</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.235702</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3.158410</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>327.0</td>\n",
       "      <td>19.657569</td>\n",
       "      <td>252.0</td>\n",
       "      <td>9.050967</td>\n",
       "      <td>104.0</td>\n",
       "      <td>-11.879394</td>\n",
       "      <td>532.0</td>\n",
       "      <td>48.648947</td>\n",
       "      <td>183.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>193.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>226.0</td>\n",
       "      <td>5.374012</td>\n",
       "      <td>188.0</td>\n",
       "      <td>7.071068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>266.0</td>\n",
       "      <td>3.672393</td>\n",
       "      <td>137.0</td>\n",
       "      <td>-2.212560</td>\n",
       "      <td>60.0</td>\n",
       "      <td>-5.725284</td>\n",
       "      <td>326.0</td>\n",
       "      <td>6.409581</td>\n",
       "      <td>170.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>201.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>207.0</td>\n",
       "      <td>0.980826</td>\n",
       "      <td>185.5</td>\n",
       "      <td>21.920310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>391.0</td>\n",
       "      <td>0.181160</td>\n",
       "      <td>704.0</td>\n",
       "      <td>3.839415</td>\n",
       "      <td>312.0</td>\n",
       "      <td>-0.742170</td>\n",
       "      <td>733.0</td>\n",
       "      <td>4.178358</td>\n",
       "      <td>436.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>315.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>363.0</td>\n",
       "      <td>-0.146096</td>\n",
       "      <td>375.5</td>\n",
       "      <td>85.559921</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  11298_1  stdR_11298  3403_1  stdR_3403  5416_1  \\\n",
       "1    chr6  32038557    109.0    0.432707   191.0   2.163536    53.0   \n",
       "2    chr6  32038800     43.0   -0.924678    86.0   3.753105    25.0   \n",
       "3    chr6  32039143      7.0   -2.828427    67.0   1.028519    21.0   \n",
       "4    chr6  32039425     62.0    2.710576    89.0   5.892557    30.0   \n",
       "5    chr6  32039555     20.0   -0.883883    77.0   1.635184    38.0   \n",
       "6    chr6  32039801     43.0   -0.271964    63.0   1.903749    29.0   \n",
       "7    chr6  32040110     53.0   -6.363961    66.0  -0.235702    30.0   \n",
       "8    chr6  32040421     39.0   -0.047140    92.0   2.451304    25.0   \n",
       "8-2  chr6  32040533     74.0    0.066291   188.0   2.585359    23.0   \n",
       "9    chr6  32041111     87.0   -0.291162   168.0   6.447150    50.0   \n",
       "10   chr6  32041480     67.0    2.309882    45.0   0.235702    35.0   \n",
       "40   chr6  32042500    327.0   19.657569   252.0   9.050967   104.0   \n",
       "35   chr6  32043800    266.0    3.672393   137.0  -2.212560    60.0   \n",
       "32   chr6  32045150    391.0    0.181160   704.0   3.839415   312.0   \n",
       "\n",
       "     stdR_5416  8239_1  stdR_8239  9412_1  stdR_9412  9562_1  stdR_9562  \\\n",
       "1    -0.749322   149.0   1.277014   122.0   0.707107    55.0  -0.707107   \n",
       "2    -2.882820    78.0   2.882820    58.0   0.707107    45.0  -0.707107   \n",
       "3    -1.928473    97.0   2.956992    62.0   0.707107    40.0  -0.707107   \n",
       "4    -1.060660    69.0   3.535534    33.0  -0.707107    45.0   0.707107   \n",
       "5    -0.088388    68.0   1.237437    56.0   0.707107    24.0  -0.707107   \n",
       "6    -1.794963    72.0   2.882820    52.0   0.707107    39.0  -0.707107   \n",
       "7   -17.206265   104.0  17.677670    68.0   0.707107    65.0  -0.707107   \n",
       "8    -0.707107   142.0   4.808326    55.0   0.707107    25.0  -0.707107   \n",
       "8-2  -1.060660   197.0   2.784233   103.0   0.707107    39.0  -0.707107   \n",
       "9    -3.369156   266.0  14.599675    82.0  -0.707107    99.0   0.707107   \n",
       "10   -0.707107    76.0   3.158410    50.0   0.707107    35.0  -0.707107   \n",
       "40  -11.879394   532.0  48.648947   183.0  -0.707107   193.0   0.707107   \n",
       "35   -5.725284   326.0   6.409581   170.0  -0.707107   201.0   0.707107   \n",
       "32   -0.742170   733.0   4.178358   436.0   0.707107   315.0  -0.707107   \n",
       "\n",
       "     9773_1  stdR_9773    avg        std  \n",
       "1      48.0  -0.854860   88.5  47.376154  \n",
       "2      45.0  -0.707107   51.5   9.192388  \n",
       "3      50.0  -0.064282   51.0  15.556349  \n",
       "4      78.0   4.596194   39.0   8.485281  \n",
       "5      39.0  -0.044194   40.0  22.627417  \n",
       "6      44.0  -0.163178   45.5   9.192388  \n",
       "7      90.0  11.078006   66.5   2.121320  \n",
       "8      66.0   1.225652   40.0  21.213203  \n",
       "8-2    89.0   0.397748   71.0  45.254834  \n",
       "9     107.0   1.372619   90.5  12.020815  \n",
       "10     67.0   2.309882   42.5  10.606602  \n",
       "40    226.0   5.374012  188.0   7.071068  \n",
       "35    207.0   0.980826  185.5  21.920310  \n",
       "32    363.0  -0.146096  375.5  85.559921  "
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_df = get_result(Path_2rd_3rd_dir, MQ=1, position=32039143)\n",
    "filtered_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "8fb9b35b-55a9-4c9f-a842-8bdc0b2e96cc",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n",
      "(14, 18)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_5</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_5</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_5</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_5</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9412_5</th>\n",
       "      <th>stdR_9412</th>\n",
       "      <th>9562_5</th>\n",
       "      <th>stdR_9562</th>\n",
       "      <th>9773_5</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>109.0</td>\n",
       "      <td>0.432707</td>\n",
       "      <td>191.0</td>\n",
       "      <td>2.163536</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-0.749322</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1.277014</td>\n",
       "      <td>122.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>55.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>48.0</td>\n",
       "      <td>-0.854860</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.924678</td>\n",
       "      <td>86.0</td>\n",
       "      <td>3.753105</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-2.882820</td>\n",
       "      <td>78.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>58.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>51.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>7.0</td>\n",
       "      <td>-2.828427</td>\n",
       "      <td>67.0</td>\n",
       "      <td>1.028519</td>\n",
       "      <td>21.0</td>\n",
       "      <td>-1.928473</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.956992</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-0.064282</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>62.0</td>\n",
       "      <td>2.710576</td>\n",
       "      <td>89.0</td>\n",
       "      <td>5.892557</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>69.0</td>\n",
       "      <td>3.535534</td>\n",
       "      <td>33.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>78.0</td>\n",
       "      <td>4.596194</td>\n",
       "      <td>39.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-0.883883</td>\n",
       "      <td>77.0</td>\n",
       "      <td>1.635184</td>\n",
       "      <td>38.0</td>\n",
       "      <td>-0.088388</td>\n",
       "      <td>68.0</td>\n",
       "      <td>1.237437</td>\n",
       "      <td>56.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.044194</td>\n",
       "      <td>40.0</td>\n",
       "      <td>22.627417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.271964</td>\n",
       "      <td>63.0</td>\n",
       "      <td>1.903749</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-1.794963</td>\n",
       "      <td>72.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-0.163178</td>\n",
       "      <td>45.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-6.363961</td>\n",
       "      <td>66.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-17.206265</td>\n",
       "      <td>104.0</td>\n",
       "      <td>17.677670</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>65.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>90.0</td>\n",
       "      <td>11.078006</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040421</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.047140</td>\n",
       "      <td>92.0</td>\n",
       "      <td>2.451304</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>142.0</td>\n",
       "      <td>4.808326</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>66.0</td>\n",
       "      <td>1.225652</td>\n",
       "      <td>40.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040533</td>\n",
       "      <td>74.0</td>\n",
       "      <td>0.066291</td>\n",
       "      <td>188.0</td>\n",
       "      <td>2.585359</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>197.0</td>\n",
       "      <td>2.784233</td>\n",
       "      <td>103.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>89.0</td>\n",
       "      <td>0.397748</td>\n",
       "      <td>71.0</td>\n",
       "      <td>45.254834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041111</td>\n",
       "      <td>87.0</td>\n",
       "      <td>-0.291162</td>\n",
       "      <td>168.0</td>\n",
       "      <td>6.447150</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-3.369156</td>\n",
       "      <td>266.0</td>\n",
       "      <td>14.599675</td>\n",
       "      <td>82.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>107.0</td>\n",
       "      <td>1.372619</td>\n",
       "      <td>90.5</td>\n",
       "      <td>12.020815</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.235702</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3.158410</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>327.0</td>\n",
       "      <td>19.657569</td>\n",
       "      <td>252.0</td>\n",
       "      <td>9.050967</td>\n",
       "      <td>104.0</td>\n",
       "      <td>-11.879394</td>\n",
       "      <td>532.0</td>\n",
       "      <td>48.648947</td>\n",
       "      <td>183.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>193.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>226.0</td>\n",
       "      <td>5.374012</td>\n",
       "      <td>188.0</td>\n",
       "      <td>7.071068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>266.0</td>\n",
       "      <td>3.672393</td>\n",
       "      <td>137.0</td>\n",
       "      <td>-2.212560</td>\n",
       "      <td>60.0</td>\n",
       "      <td>-5.725284</td>\n",
       "      <td>326.0</td>\n",
       "      <td>6.409581</td>\n",
       "      <td>170.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>201.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>207.0</td>\n",
       "      <td>0.980826</td>\n",
       "      <td>185.5</td>\n",
       "      <td>21.920310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>391.0</td>\n",
       "      <td>0.181160</td>\n",
       "      <td>704.0</td>\n",
       "      <td>3.839415</td>\n",
       "      <td>312.0</td>\n",
       "      <td>-0.742170</td>\n",
       "      <td>733.0</td>\n",
       "      <td>4.178358</td>\n",
       "      <td>436.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>315.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>363.0</td>\n",
       "      <td>-0.146096</td>\n",
       "      <td>375.5</td>\n",
       "      <td>85.559921</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  11298_5  stdR_11298  3403_5  stdR_3403  5416_5  \\\n",
       "1    chr6  32038557    109.0    0.432707   191.0   2.163536    53.0   \n",
       "2    chr6  32038800     43.0   -0.924678    86.0   3.753105    25.0   \n",
       "3    chr6  32039143      7.0   -2.828427    67.0   1.028519    21.0   \n",
       "4    chr6  32039425     62.0    2.710576    89.0   5.892557    30.0   \n",
       "5    chr6  32039555     20.0   -0.883883    77.0   1.635184    38.0   \n",
       "6    chr6  32039801     43.0   -0.271964    63.0   1.903749    29.0   \n",
       "7    chr6  32040110     53.0   -6.363961    66.0  -0.235702    30.0   \n",
       "8    chr6  32040421     39.0   -0.047140    92.0   2.451304    25.0   \n",
       "8-2  chr6  32040533     74.0    0.066291   188.0   2.585359    23.0   \n",
       "9    chr6  32041111     87.0   -0.291162   168.0   6.447150    50.0   \n",
       "10   chr6  32041480     67.0    2.309882    45.0   0.235702    35.0   \n",
       "40   chr6  32042500    327.0   19.657569   252.0   9.050967   104.0   \n",
       "35   chr6  32043800    266.0    3.672393   137.0  -2.212560    60.0   \n",
       "32   chr6  32045150    391.0    0.181160   704.0   3.839415   312.0   \n",
       "\n",
       "     stdR_5416  8239_5  stdR_8239  9412_5  stdR_9412  9562_5  stdR_9562  \\\n",
       "1    -0.749322   149.0   1.277014   122.0   0.707107    55.0  -0.707107   \n",
       "2    -2.882820    78.0   2.882820    58.0   0.707107    45.0  -0.707107   \n",
       "3    -1.928473    97.0   2.956992    62.0   0.707107    40.0  -0.707107   \n",
       "4    -1.060660    69.0   3.535534    33.0  -0.707107    45.0   0.707107   \n",
       "5    -0.088388    68.0   1.237437    56.0   0.707107    24.0  -0.707107   \n",
       "6    -1.794963    72.0   2.882820    52.0   0.707107    39.0  -0.707107   \n",
       "7   -17.206265   104.0  17.677670    68.0   0.707107    65.0  -0.707107   \n",
       "8    -0.707107   142.0   4.808326    55.0   0.707107    25.0  -0.707107   \n",
       "8-2  -1.060660   197.0   2.784233   103.0   0.707107    39.0  -0.707107   \n",
       "9    -3.369156   266.0  14.599675    82.0  -0.707107    99.0   0.707107   \n",
       "10   -0.707107    76.0   3.158410    50.0   0.707107    35.0  -0.707107   \n",
       "40  -11.879394   532.0  48.648947   183.0  -0.707107   193.0   0.707107   \n",
       "35   -5.725284   326.0   6.409581   170.0  -0.707107   201.0   0.707107   \n",
       "32   -0.742170   733.0   4.178358   436.0   0.707107   315.0  -0.707107   \n",
       "\n",
       "     9773_5  stdR_9773    avg        std  \n",
       "1      48.0  -0.854860   88.5  47.376154  \n",
       "2      45.0  -0.707107   51.5   9.192388  \n",
       "3      50.0  -0.064282   51.0  15.556349  \n",
       "4      78.0   4.596194   39.0   8.485281  \n",
       "5      39.0  -0.044194   40.0  22.627417  \n",
       "6      44.0  -0.163178   45.5   9.192388  \n",
       "7      90.0  11.078006   66.5   2.121320  \n",
       "8      66.0   1.225652   40.0  21.213203  \n",
       "8-2    89.0   0.397748   71.0  45.254834  \n",
       "9     107.0   1.372619   90.5  12.020815  \n",
       "10     67.0   2.309882   42.5  10.606602  \n",
       "40    226.0   5.374012  188.0   7.071068  \n",
       "35    207.0   0.980826  185.5  21.920310  \n",
       "32    363.0  -0.146096  375.5  85.559921  "
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_df = get_result(Path_2rd_3rd_dir, MQ=5, position=32039143)\n",
    "filtered_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "679fdec3-c819-404d-8b68-2830fde108a0",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n",
      "(14, 18)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_10</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_10</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_10</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_10</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9412_10</th>\n",
       "      <th>stdR_9412</th>\n",
       "      <th>9562_10</th>\n",
       "      <th>stdR_9562</th>\n",
       "      <th>9773_10</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>109.0</td>\n",
       "      <td>0.432707</td>\n",
       "      <td>191.0</td>\n",
       "      <td>2.163536</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-0.749322</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1.277014</td>\n",
       "      <td>122.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>55.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>48.0</td>\n",
       "      <td>-0.854860</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.924678</td>\n",
       "      <td>86.0</td>\n",
       "      <td>3.753105</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-2.882820</td>\n",
       "      <td>78.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>58.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>51.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>7.0</td>\n",
       "      <td>-2.828427</td>\n",
       "      <td>67.0</td>\n",
       "      <td>1.028519</td>\n",
       "      <td>21.0</td>\n",
       "      <td>-1.928473</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.956992</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-0.064282</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>62.0</td>\n",
       "      <td>2.710576</td>\n",
       "      <td>89.0</td>\n",
       "      <td>5.892557</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>69.0</td>\n",
       "      <td>3.535534</td>\n",
       "      <td>33.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>78.0</td>\n",
       "      <td>4.596194</td>\n",
       "      <td>39.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-0.883883</td>\n",
       "      <td>77.0</td>\n",
       "      <td>1.635184</td>\n",
       "      <td>38.0</td>\n",
       "      <td>-0.088388</td>\n",
       "      <td>68.0</td>\n",
       "      <td>1.237437</td>\n",
       "      <td>56.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.044194</td>\n",
       "      <td>40.0</td>\n",
       "      <td>22.627417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-0.271964</td>\n",
       "      <td>63.0</td>\n",
       "      <td>1.903749</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-1.794963</td>\n",
       "      <td>72.0</td>\n",
       "      <td>2.882820</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-0.163178</td>\n",
       "      <td>45.5</td>\n",
       "      <td>9.192388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-6.363961</td>\n",
       "      <td>66.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-17.206265</td>\n",
       "      <td>104.0</td>\n",
       "      <td>17.677670</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>65.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>90.0</td>\n",
       "      <td>11.078006</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040421</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.047140</td>\n",
       "      <td>92.0</td>\n",
       "      <td>2.451304</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>142.0</td>\n",
       "      <td>4.808326</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>66.0</td>\n",
       "      <td>1.225652</td>\n",
       "      <td>40.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040533</td>\n",
       "      <td>74.0</td>\n",
       "      <td>0.066291</td>\n",
       "      <td>188.0</td>\n",
       "      <td>2.585359</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>197.0</td>\n",
       "      <td>2.784233</td>\n",
       "      <td>103.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>89.0</td>\n",
       "      <td>0.397748</td>\n",
       "      <td>71.0</td>\n",
       "      <td>45.254834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041111</td>\n",
       "      <td>87.0</td>\n",
       "      <td>-0.291162</td>\n",
       "      <td>168.0</td>\n",
       "      <td>6.447150</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-3.369156</td>\n",
       "      <td>266.0</td>\n",
       "      <td>14.599675</td>\n",
       "      <td>82.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>107.0</td>\n",
       "      <td>1.372619</td>\n",
       "      <td>90.5</td>\n",
       "      <td>12.020815</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.235702</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3.158410</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>327.0</td>\n",
       "      <td>19.657569</td>\n",
       "      <td>252.0</td>\n",
       "      <td>9.050967</td>\n",
       "      <td>104.0</td>\n",
       "      <td>-11.879394</td>\n",
       "      <td>532.0</td>\n",
       "      <td>48.648947</td>\n",
       "      <td>183.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>193.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>226.0</td>\n",
       "      <td>5.374012</td>\n",
       "      <td>188.0</td>\n",
       "      <td>7.071068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>266.0</td>\n",
       "      <td>3.672393</td>\n",
       "      <td>137.0</td>\n",
       "      <td>-2.212560</td>\n",
       "      <td>60.0</td>\n",
       "      <td>-5.725284</td>\n",
       "      <td>326.0</td>\n",
       "      <td>6.409581</td>\n",
       "      <td>170.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>201.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>207.0</td>\n",
       "      <td>0.980826</td>\n",
       "      <td>185.5</td>\n",
       "      <td>21.920310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>391.0</td>\n",
       "      <td>0.181160</td>\n",
       "      <td>704.0</td>\n",
       "      <td>3.839415</td>\n",
       "      <td>312.0</td>\n",
       "      <td>-0.742170</td>\n",
       "      <td>733.0</td>\n",
       "      <td>4.178358</td>\n",
       "      <td>436.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>315.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>363.0</td>\n",
       "      <td>-0.146096</td>\n",
       "      <td>375.5</td>\n",
       "      <td>85.559921</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  11298_10  stdR_11298  3403_10  stdR_3403  5416_10  \\\n",
       "1    chr6  32038557     109.0    0.432707    191.0   2.163536     53.0   \n",
       "2    chr6  32038800      43.0   -0.924678     86.0   3.753105     25.0   \n",
       "3    chr6  32039143       7.0   -2.828427     67.0   1.028519     21.0   \n",
       "4    chr6  32039425      62.0    2.710576     89.0   5.892557     30.0   \n",
       "5    chr6  32039555      20.0   -0.883883     77.0   1.635184     38.0   \n",
       "6    chr6  32039801      43.0   -0.271964     63.0   1.903749     29.0   \n",
       "7    chr6  32040110      53.0   -6.363961     66.0  -0.235702     30.0   \n",
       "8    chr6  32040421      39.0   -0.047140     92.0   2.451304     25.0   \n",
       "8-2  chr6  32040533      74.0    0.066291    188.0   2.585359     23.0   \n",
       "9    chr6  32041111      87.0   -0.291162    168.0   6.447150     50.0   \n",
       "10   chr6  32041480      67.0    2.309882     45.0   0.235702     35.0   \n",
       "40   chr6  32042500     327.0   19.657569    252.0   9.050967    104.0   \n",
       "35   chr6  32043800     266.0    3.672393    137.0  -2.212560     60.0   \n",
       "32   chr6  32045150     391.0    0.181160    704.0   3.839415    312.0   \n",
       "\n",
       "     stdR_5416  8239_10  stdR_8239  9412_10  stdR_9412  9562_10  stdR_9562  \\\n",
       "1    -0.749322    149.0   1.277014    122.0   0.707107     55.0  -0.707107   \n",
       "2    -2.882820     78.0   2.882820     58.0   0.707107     45.0  -0.707107   \n",
       "3    -1.928473     97.0   2.956992     62.0   0.707107     40.0  -0.707107   \n",
       "4    -1.060660     69.0   3.535534     33.0  -0.707107     45.0   0.707107   \n",
       "5    -0.088388     68.0   1.237437     56.0   0.707107     24.0  -0.707107   \n",
       "6    -1.794963     72.0   2.882820     52.0   0.707107     39.0  -0.707107   \n",
       "7   -17.206265    104.0  17.677670     68.0   0.707107     65.0  -0.707107   \n",
       "8    -0.707107    142.0   4.808326     55.0   0.707107     25.0  -0.707107   \n",
       "8-2  -1.060660    197.0   2.784233    103.0   0.707107     39.0  -0.707107   \n",
       "9    -3.369156    266.0  14.599675     82.0  -0.707107     99.0   0.707107   \n",
       "10   -0.707107     76.0   3.158410     50.0   0.707107     35.0  -0.707107   \n",
       "40  -11.879394    532.0  48.648947    183.0  -0.707107    193.0   0.707107   \n",
       "35   -5.725284    326.0   6.409581    170.0  -0.707107    201.0   0.707107   \n",
       "32   -0.742170    733.0   4.178358    436.0   0.707107    315.0  -0.707107   \n",
       "\n",
       "     9773_10  stdR_9773    avg        std  \n",
       "1       48.0  -0.854860   88.5  47.376154  \n",
       "2       45.0  -0.707107   51.5   9.192388  \n",
       "3       50.0  -0.064282   51.0  15.556349  \n",
       "4       78.0   4.596194   39.0   8.485281  \n",
       "5       39.0  -0.044194   40.0  22.627417  \n",
       "6       44.0  -0.163178   45.5   9.192388  \n",
       "7       90.0  11.078006   66.5   2.121320  \n",
       "8       66.0   1.225652   40.0  21.213203  \n",
       "8-2     89.0   0.397748   71.0  45.254834  \n",
       "9      107.0   1.372619   90.5  12.020815  \n",
       "10      67.0   2.309882   42.5  10.606602  \n",
       "40     226.0   5.374012  188.0   7.071068  \n",
       "35     207.0   0.980826  185.5  21.920310  \n",
       "32     363.0  -0.146096  375.5  85.559921  "
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_df = get_result(Path_2rd_3rd_dir, MQ=10, position=32039143)\n",
    "filtered_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "c7503d8f-3224-49b6-8c19-c6c86a37fd23",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['NGS_11298_BW_C', 'NGS_3403_BW_C', 'NGS_5416_BW_C', 'NGS_8239_BW_C', 'NGS_9412_BW_C', 'NGS_9562_BW_C', 'NGS_9773_BW_C']\n",
      "(14, 18)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>position</th>\n",
       "      <th>11298_20</th>\n",
       "      <th>stdR_11298</th>\n",
       "      <th>3403_20</th>\n",
       "      <th>stdR_3403</th>\n",
       "      <th>5416_20</th>\n",
       "      <th>stdR_5416</th>\n",
       "      <th>8239_20</th>\n",
       "      <th>stdR_8239</th>\n",
       "      <th>9412_20</th>\n",
       "      <th>stdR_9412</th>\n",
       "      <th>9562_20</th>\n",
       "      <th>stdR_9562</th>\n",
       "      <th>9773_20</th>\n",
       "      <th>stdR_9773</th>\n",
       "      <th>avg</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038557</td>\n",
       "      <td>108.0</td>\n",
       "      <td>0.411599</td>\n",
       "      <td>191.0</td>\n",
       "      <td>2.163536</td>\n",
       "      <td>51.0</td>\n",
       "      <td>-0.791537</td>\n",
       "      <td>146.0</td>\n",
       "      <td>1.213691</td>\n",
       "      <td>122.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>55.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>47.0</td>\n",
       "      <td>-0.875968</td>\n",
       "      <td>88.5</td>\n",
       "      <td>47.376154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32038800</td>\n",
       "      <td>42.0</td>\n",
       "      <td>-1.060660</td>\n",
       "      <td>86.0</td>\n",
       "      <td>4.124790</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-3.064129</td>\n",
       "      <td>76.0</td>\n",
       "      <td>2.946278</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>45.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-0.824958</td>\n",
       "      <td>51.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039143</td>\n",
       "      <td>6.0</td>\n",
       "      <td>-2.892710</td>\n",
       "      <td>66.0</td>\n",
       "      <td>0.964237</td>\n",
       "      <td>21.0</td>\n",
       "      <td>-1.928473</td>\n",
       "      <td>96.0</td>\n",
       "      <td>2.892710</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>40.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>50.0</td>\n",
       "      <td>-0.064282</td>\n",
       "      <td>51.0</td>\n",
       "      <td>15.556349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039425</td>\n",
       "      <td>62.0</td>\n",
       "      <td>3.021274</td>\n",
       "      <td>85.0</td>\n",
       "      <td>5.978266</td>\n",
       "      <td>29.0</td>\n",
       "      <td>-1.221366</td>\n",
       "      <td>67.0</td>\n",
       "      <td>3.664099</td>\n",
       "      <td>33.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>78.0</td>\n",
       "      <td>5.078312</td>\n",
       "      <td>38.5</td>\n",
       "      <td>7.778175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039555</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-0.754247</td>\n",
       "      <td>70.0</td>\n",
       "      <td>1.602775</td>\n",
       "      <td>31.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>65.0</td>\n",
       "      <td>1.367073</td>\n",
       "      <td>51.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>21.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>37.0</td>\n",
       "      <td>0.047140</td>\n",
       "      <td>36.0</td>\n",
       "      <td>21.213203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32039801</td>\n",
       "      <td>42.0</td>\n",
       "      <td>-0.353553</td>\n",
       "      <td>62.0</td>\n",
       "      <td>2.003469</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-2.357023</td>\n",
       "      <td>72.0</td>\n",
       "      <td>3.181981</td>\n",
       "      <td>51.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>39.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>44.0</td>\n",
       "      <td>-0.117851</td>\n",
       "      <td>45.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040110</td>\n",
       "      <td>53.0</td>\n",
       "      <td>-6.363961</td>\n",
       "      <td>66.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-17.206265</td>\n",
       "      <td>102.0</td>\n",
       "      <td>16.734860</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>65.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>90.0</td>\n",
       "      <td>11.078006</td>\n",
       "      <td>66.5</td>\n",
       "      <td>2.121320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040421</td>\n",
       "      <td>38.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>92.0</td>\n",
       "      <td>2.727412</td>\n",
       "      <td>25.0</td>\n",
       "      <td>-0.656599</td>\n",
       "      <td>138.0</td>\n",
       "      <td>5.050763</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>66.0</td>\n",
       "      <td>1.414214</td>\n",
       "      <td>38.0</td>\n",
       "      <td>19.798990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8-2</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32040533</td>\n",
       "      <td>73.0</td>\n",
       "      <td>0.054393</td>\n",
       "      <td>187.0</td>\n",
       "      <td>2.534706</td>\n",
       "      <td>23.0</td>\n",
       "      <td>-1.033464</td>\n",
       "      <td>196.0</td>\n",
       "      <td>2.730520</td>\n",
       "      <td>103.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>38.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>87.0</td>\n",
       "      <td>0.358993</td>\n",
       "      <td>70.5</td>\n",
       "      <td>45.961941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041111</td>\n",
       "      <td>87.0</td>\n",
       "      <td>-0.235702</td>\n",
       "      <td>167.0</td>\n",
       "      <td>6.049691</td>\n",
       "      <td>48.0</td>\n",
       "      <td>-3.299832</td>\n",
       "      <td>263.0</td>\n",
       "      <td>13.592164</td>\n",
       "      <td>81.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>107.0</td>\n",
       "      <td>1.335646</td>\n",
       "      <td>90.0</td>\n",
       "      <td>12.727922</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32041480</td>\n",
       "      <td>67.0</td>\n",
       "      <td>2.309882</td>\n",
       "      <td>43.0</td>\n",
       "      <td>0.047140</td>\n",
       "      <td>34.0</td>\n",
       "      <td>-0.801388</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3.158410</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>64.0</td>\n",
       "      <td>2.027039</td>\n",
       "      <td>42.5</td>\n",
       "      <td>10.606602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32042500</td>\n",
       "      <td>326.0</td>\n",
       "      <td>16.734860</td>\n",
       "      <td>250.0</td>\n",
       "      <td>7.778175</td>\n",
       "      <td>103.0</td>\n",
       "      <td>-9.545942</td>\n",
       "      <td>518.0</td>\n",
       "      <td>39.362277</td>\n",
       "      <td>178.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>190.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>225.0</td>\n",
       "      <td>4.831896</td>\n",
       "      <td>184.0</td>\n",
       "      <td>8.485281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32043800</td>\n",
       "      <td>266.0</td>\n",
       "      <td>3.492679</td>\n",
       "      <td>137.0</td>\n",
       "      <td>-2.035610</td>\n",
       "      <td>60.0</td>\n",
       "      <td>-5.335442</td>\n",
       "      <td>321.0</td>\n",
       "      <td>5.849702</td>\n",
       "      <td>168.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>201.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>206.0</td>\n",
       "      <td>0.921382</td>\n",
       "      <td>184.5</td>\n",
       "      <td>23.334524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>chr6</td>\n",
       "      <td>32045150</td>\n",
       "      <td>386.0</td>\n",
       "      <td>0.167788</td>\n",
       "      <td>700.0</td>\n",
       "      <td>3.931034</td>\n",
       "      <td>306.0</td>\n",
       "      <td>-0.791001</td>\n",
       "      <td>722.0</td>\n",
       "      <td>4.194701</td>\n",
       "      <td>431.0</td>\n",
       "      <td>0.707107</td>\n",
       "      <td>313.0</td>\n",
       "      <td>-0.707107</td>\n",
       "      <td>359.0</td>\n",
       "      <td>-0.155803</td>\n",
       "      <td>372.0</td>\n",
       "      <td>83.438600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      chr  position  11298_20  stdR_11298  3403_20  stdR_3403  5416_20  \\\n",
       "1    chr6  32038557     108.0    0.411599    191.0   2.163536     51.0   \n",
       "2    chr6  32038800      42.0   -1.060660     86.0   4.124790     25.0   \n",
       "3    chr6  32039143       6.0   -2.892710     66.0   0.964237     21.0   \n",
       "4    chr6  32039425      62.0    3.021274     85.0   5.978266     29.0   \n",
       "5    chr6  32039555      20.0   -0.754247     70.0   1.602775     31.0   \n",
       "6    chr6  32039801      42.0   -0.353553     62.0   2.003469     25.0   \n",
       "7    chr6  32040110      53.0   -6.363961     66.0  -0.235702     30.0   \n",
       "8    chr6  32040421      38.0    0.000000     92.0   2.727412     25.0   \n",
       "8-2  chr6  32040533      73.0    0.054393    187.0   2.534706     23.0   \n",
       "9    chr6  32041111      87.0   -0.235702    167.0   6.049691     48.0   \n",
       "10   chr6  32041480      67.0    2.309882     43.0   0.047140     34.0   \n",
       "40   chr6  32042500     326.0   16.734860    250.0   7.778175    103.0   \n",
       "35   chr6  32043800     266.0    3.492679    137.0  -2.035610     60.0   \n",
       "32   chr6  32045150     386.0    0.167788    700.0   3.931034    306.0   \n",
       "\n",
       "     stdR_5416  8239_20  stdR_8239  9412_20  stdR_9412  9562_20  stdR_9562  \\\n",
       "1    -0.791537    146.0   1.213691    122.0   0.707107     55.0  -0.707107   \n",
       "2    -3.064129     76.0   2.946278     57.0   0.707107     45.0  -0.707107   \n",
       "3    -1.928473     96.0   2.892710     62.0   0.707107     40.0  -0.707107   \n",
       "4    -1.221366     67.0   3.664099     33.0  -0.707107     44.0   0.707107   \n",
       "5    -0.235702     65.0   1.367073     51.0   0.707107     21.0  -0.707107   \n",
       "6    -2.357023     72.0   3.181981     51.0   0.707107     39.0  -0.707107   \n",
       "7   -17.206265    102.0  16.734860     68.0   0.707107     65.0  -0.707107   \n",
       "8    -0.656599    138.0   5.050763     52.0   0.707107     24.0  -0.707107   \n",
       "8-2  -1.033464    196.0   2.730520    103.0   0.707107     38.0  -0.707107   \n",
       "9    -3.299832    263.0  13.592164     81.0  -0.707107     99.0   0.707107   \n",
       "10   -0.801388     76.0   3.158410     50.0   0.707107     35.0  -0.707107   \n",
       "40   -9.545942    518.0  39.362277    178.0  -0.707107    190.0   0.707107   \n",
       "35   -5.335442    321.0   5.849702    168.0  -0.707107    201.0   0.707107   \n",
       "32   -0.791001    722.0   4.194701    431.0   0.707107    313.0  -0.707107   \n",
       "\n",
       "     9773_20  stdR_9773    avg        std  \n",
       "1       47.0  -0.875968   88.5  47.376154  \n",
       "2       44.0  -0.824958   51.0   8.485281  \n",
       "3       50.0  -0.064282   51.0  15.556349  \n",
       "4       78.0   5.078312   38.5   7.778175  \n",
       "5       37.0   0.047140   36.0  21.213203  \n",
       "6       44.0  -0.117851   45.0   8.485281  \n",
       "7       90.0  11.078006   66.5   2.121320  \n",
       "8       66.0   1.414214   38.0  19.798990  \n",
       "8-2     87.0   0.358993   70.5  45.961941  \n",
       "9      107.0   1.335646   90.0  12.727922  \n",
       "10      64.0   2.027039   42.5  10.606602  \n",
       "40     225.0   4.831896  184.0   8.485281  \n",
       "35     206.0   0.921382  184.5  23.334524  \n",
       "32     359.0  -0.155803  372.0  83.438600  "
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_df = get_result(Path_2rd_3rd_dir, MQ=20, position=32039143)\n",
    "filtered_df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67da3826-117d-4edb-94e3-b06db3f5ac06",
   "metadata": {},
   "source": [
    "## 公共序列 depth"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd13f75c-d8ac-416f-b530-59b43a3ba4e4",
   "metadata": {},
   "outputs": [],
   "source": [
    "GGXL = ['32037674', '32038679', '32039277', '32040662', '32040966', '32041939', '32042747', '32043019', '32043188', '32043485', '32044529']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f0a481f6-9ba0-4779-9e39-c910e2687b42",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c19739f4-4dd2-4d3d-9d23-fe015b552622",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a69f06d4-cd70-49d5-b5bc-0f04e421edd9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "karl",
   "language": "python",
   "name": "karl"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
